public class SetUIDFileAccess extends Object implements FileAccess
DEFAULT_BUFFERSIZE| Constructor and Description |
|---|
SetUIDFileAccess() |
| Modifier and Type | Method and Description |
|---|---|
void |
asUser(Runnable runnable,
String userID,
String groupID)
execute the given Runnable as given user
|
String |
getHome(String userID)
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 dir,
String userID,
String groupID)
lists files in the given directory
|
void |
mkdir(String path,
String userID,
String groupID)
create a directory.
|
InputStream |
readFile(String canonicalPath,
String userID,
String groupID,
int bufferSize)
create a
InputStream for reading |
void |
rm(String path,
String userID,
String groupID)
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 |
public InputStream readFile(String canonicalPath, String userID, String groupID, int bufferSize) throws Exception
FileAccessInputStream for readingreadFile in interface FileAccesscanonicalPath - - the canonical path to the fileuserID - - the user idgroupID - - the group idbufferSize - - the buffer size for reading fromInputStreamExceptionpublic OutputStream writeFile(String canonicalPath, boolean append, String userID, String groupID, int bufferSize) throws Exception
FileAccessOutputStream for writingwriteFile in interface FileAccesscanonicalPath - - the canonical path to the fileuserID - - the user idgroupID - - the group idbufferSize - - the buffer size for writing to diskOutputStreamExceptionpublic void setUser(String canonicalPath, String user, String group) throws Exception
FileAccesssetUser in interface FileAccessExceptionpublic RandomAccessFile getRandomAccessFile(File file, String userID, String groupID, String mode) throws IOException
FileAccessRandomAccessFile for accessing the given pathgetRandomAccessFile in interface FileAccessfile - - the pathuserID - - the user idgroupID - - the group idmode - - the mode (see RandomAccessFile.RandomAccessFile(java.io.File, String)IOExceptionpublic FileInfo[] listFiles(File dir, String userID, String groupID)
FileAccesslistFiles in interface FileAccessuserID - - the user idgroupID - - the group idFileInfo objectspublic FileInfo stat(String path, String userID, String groupID)
FileAccessstat in interface FileAccesspath - - the fileuserID - - the user idgroupID - - the group idpublic void mkdir(String path, String userID, String groupID) throws IOException
FileAccessmkdir in interface FileAccesspath - - the directory to createuserID - - user IDgroupID - - group IPIOExceptionpublic void rm(String path, String userID, String groupID) throws IOException
FileAccessrm in interface FileAccesspath - - the file/directory to deleteuserID - - user IDgroupID - - group IPIOExceptionpublic String getHome(String userID)
FileAccessgetHome in interface FileAccesspublic void asUser(Runnable runnable, String userID, String groupID) throws Exception
FileAccessasUser in interface FileAccessrunnable - - a very SHORT taskuserID - - user IDgroupID - - group IDExceptionCopyright © 2010–2016 UNICORE. All rights reserved.