public class DefaultFileAccess extends Object implements FileAccess
FileAccess interface.
This is used if the SetUID version is not available.DEFAULT_BUFFERSIZE| Constructor and Description |
|---|
DefaultFileAccess() |
| Modifier and Type | Method and Description |
|---|---|
void |
asUser(Runnable runnable,
String user,
String group)
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 canonicalPath,
String user,
String group)
create a directory.
|
InputStream |
readFile(String canonicalPath,
String userID,
String groupID,
int size)
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 size)
create a
OutputStream for writing |
public InputStream readFile(String canonicalPath, String userID, String groupID, int size) throws Exception
FileAccessInputStream for readingreadFile in interface FileAccesscanonicalPath - - the canonical path to the fileuserID - - the user idgroupID - - the group idsize - - the buffer size for reading fromInputStreamExceptionpublic void setUser(String canonicalPath, String user, String group) throws Exception
FileAccesssetUser in interface FileAccessExceptionpublic OutputStream writeFile(String canonicalPath, boolean append, String userID, String groupID, int size) throws Exception
FileAccessOutputStream for writingwriteFile in interface FileAccesscanonicalPath - - the canonical path to the fileuserID - - the user idgroupID - - the group idsize - - the buffer size for writing to diskOutputStreamExceptionpublic 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 void mkdir(String canonicalPath, String user, String group) throws Exception
FileAccessmkdir in interface FileAccesscanonicalPath - - the directory to createuser - - user IDgroup - - group IPExceptionpublic void rm(String canonicalPath, String user, String group) throws Exception
FileAccessrm in interface FileAccesscanonicalPath - - the file/directory to deleteuser - - user IDgroup - - group IPExceptionpublic 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 String getHome(String userID)
FileAccessgetHome in interface FileAccesspublic void asUser(Runnable runnable, String user, String group) throws Exception
FileAccessasUser in interface FileAccessrunnable - - a very SHORT taskuser - - user IDgroup - - group IDExceptionCopyright © 2010–2016 UNICORE. All rights reserved.