public interface FileAccess
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFERSIZE
default file read/write buffersize in bytes
|
Modifier and Type | Method and Description |
---|---|
void |
asUser(Runnable runnable,
String user,
String group)
execute the given Runnable as given user
|
String |
getHome(String user)
gets the user's home directory
|
RandomAccessFile |
getRandomAccessFile(File file,
String userID,
String groupID,
String mode)
create a
RandomAccessFile for accessing the given path |
FileInfo[] |
listFiles(File directory,
String userID,
String groupID)
lists files in the given directory
|
void |
mkdir(String canonicalPath,
String user,
String group)
create a directory.
|
InputStream |
readFile(String canonicalPath,
String userID,
String groupID,
int bufferSize)
create a
InputStream for reading |
void |
rm(String canonicalPath,
String user,
String group)
delete a file or directory
|
void |
setUser(String canonicalPath,
String user,
String group)
set user/group on the given file
|
FileInfo |
stat(String path,
String userID,
String groupID)
get info on a single file
|
OutputStream |
writeFile(String canonicalPath,
boolean append,
String userID,
String groupID,
int bufferSize)
create a
OutputStream for writing |
static final int DEFAULT_BUFFERSIZE
InputStream readFile(String canonicalPath, String userID, String groupID, int bufferSize) throws Exception
InputStream
for readingcanonicalPath
- - the canonical path to the fileuserID
- - the user idgroupID
- - the group idbufferSize
- - the buffer size for reading fromInputStream
Exception
RandomAccessFile getRandomAccessFile(File file, String userID, String groupID, String mode) throws IOException
RandomAccessFile
for accessing the given pathfile
- - the pathuserID
- - the user idgroupID
- - the group idmode
- - the mode (see RandomAccessFile.RandomAccessFile(java.io.File, String)
IOException
Exception
FileInfo[] listFiles(File directory, String userID, String groupID)
parent
- - the parent fileuserID
- - the user idgroupID
- - the group idFileInfo
objectsFileInfo stat(String path, String userID, String groupID)
path
- - the fileuserID
- - the user idgroupID
- - the group idOutputStream writeFile(String canonicalPath, boolean append, String userID, String groupID, int bufferSize) throws Exception
OutputStream
for writingcanonicalPath
- - the canonical path to the fileuserID
- - the user idgroupID
- - the group idbufferSize
- - the buffer size for writing to diskOutputStream
Exception
void setUser(String canonicalPath, String user, String group) throws Exception
canonicalPath
- user
- group
- Exception
void mkdir(String canonicalPath, String user, String group) throws Exception
canonicalPath
- - the directory to createuser
- - user IDgroup
- - group IPException
void rm(String canonicalPath, String user, String group) throws Exception
canonicalPath
- - the file/directory to deleteuser
- - user IDgroup
- - group IPException
String getHome(String user)
user
- Exception
Copyright © 2010–2016 UNICORE. All rights reserved.