Class ExampleFileSystem
java.lang.Object
ExampleFileSystem
- All Implemented Interfaces:
- FileSystem
public class ExampleFileSystem
- extends Object
- implements FileSystem
A Simple local file based SSHD file system.
To instruct the server where to look for the root of the file system "/", use
the system property below. For example if you wanted to provide access to the
root of a windows machine you could set the following property
System.setProperty("ExampleSSHD.filesystem.root", "C:\\");
|
Method Summary |
void |
closeFile(byte[] handle)
|
boolean |
closeFile(byte[] handle,
boolean remove)
|
void |
closeFilesystem()
|
void |
createSymbolicLink(String link,
String target)
|
boolean |
fileExists(String path)
|
String |
getDefaultPath()
|
SftpFileAttributes |
getFileAttributes(byte[] handle)
|
SftpFileAttributes |
getFileAttributes(String path)
|
File |
getHome()
|
InputStream |
getInputStream(String path)
|
String |
getPathForHandle(byte[] handle)
|
String |
getRealPath(String path)
|
File |
getRoot()
|
void |
init(Connection con,
String protocolInUse)
|
boolean |
makeDirectory(String path)
|
byte[] |
openDirectory(String path)
|
byte[] |
openFile(String path,
com.maverick.util.UnsignedInteger32 flags,
SftpFileAttributes attrs)
|
SftpFile[] |
readDirectory(byte[] handle)
|
int |
readFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] buf,
int start,
int numBytesToRead)
|
SftpFile |
readSymbolicLink(String path)
|
void |
removeDirectory(String path)
|
void |
removeFile(String path)
|
void |
renameFile(String oldpath,
String newpath)
|
void |
setFileAttributes(byte[] handle,
SftpFileAttributes attrs)
|
void |
setFileAttributes(String path,
SftpFileAttributes attrs)
|
String |
translateNFSPath(File nfspath)
|
File |
translateVFSPath(String vfspath)
|
void |
writeFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] data,
int off,
int len)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ExampleFileSystem
public ExampleFileSystem()
getRoot
public File getRoot()
getHome
public File getHome()
init
public void init(Connection con,
String protocolInUse)
throws IOException
- Throws:
IOException
closeFilesystem
public void closeFilesystem()
- Specified by:
closeFilesystem in interface FileSystem
translateVFSPath
public File translateVFSPath(String vfspath)
throws IOException
- Throws:
IOException
translateNFSPath
public String translateNFSPath(File nfspath)
makeDirectory
public boolean makeDirectory(String path)
throws PermissionDeniedException,
FileNotFoundException,
IOException
- Specified by:
makeDirectory in interface FileSystem
- Throws:
PermissionDeniedException
FileNotFoundException
IOException
getFileAttributes
public SftpFileAttributes getFileAttributes(byte[] handle)
throws IOException,
InvalidHandleException
- Specified by:
getFileAttributes in interface FileSystem
- Throws:
IOException
InvalidHandleException
getFileAttributes
public SftpFileAttributes getFileAttributes(String path)
throws IOException,
FileNotFoundException,
PermissionDeniedException
- Specified by:
getFileAttributes in interface FileSystem
- Throws:
IOException
FileNotFoundException
PermissionDeniedException
openDirectory
public byte[] openDirectory(String path)
throws PermissionDeniedException,
FileNotFoundException,
IOException
- Specified by:
openDirectory in interface FileSystem
- Throws:
PermissionDeniedException
FileNotFoundException
IOException
readDirectory
public SftpFile[] readDirectory(byte[] handle)
throws InvalidHandleException,
EOFException,
IOException,
PermissionDeniedException
- Specified by:
readDirectory in interface FileSystem
- Throws:
InvalidHandleException
EOFException
IOException
PermissionDeniedException
getInputStream
public InputStream getInputStream(String path)
throws FileNotFoundException,
PermissionDeniedException,
IOException
- Throws:
FileNotFoundException
PermissionDeniedException
IOException
openFile
public byte[] openFile(String path,
com.maverick.util.UnsignedInteger32 flags,
SftpFileAttributes attrs)
throws PermissionDeniedException,
FileNotFoundException,
IOException
- Specified by:
openFile in interface FileSystem
- Throws:
PermissionDeniedException
FileNotFoundException
IOException
readFile
public int readFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] buf,
int start,
int numBytesToRead)
throws InvalidHandleException,
EOFException,
IOException
- Specified by:
readFile in interface FileSystem
- Throws:
InvalidHandleException
EOFException
IOException
writeFile
public void writeFile(byte[] handle,
com.maverick.util.UnsignedInteger64 offset,
byte[] data,
int off,
int len)
throws InvalidHandleException,
IOException
- Specified by:
writeFile in interface FileSystem
- Throws:
InvalidHandleException
IOException
closeFile
public void closeFile(byte[] handle)
throws InvalidHandleException,
IOException
- Specified by:
closeFile in interface FileSystem
- Throws:
InvalidHandleException
IOException
closeFile
public boolean closeFile(byte[] handle,
boolean remove)
throws InvalidHandleException,
IOException
- Throws:
InvalidHandleException
IOException
removeFile
public void removeFile(String path)
throws PermissionDeniedException,
IOException,
FileNotFoundException
- Specified by:
removeFile in interface FileSystem
- Throws:
PermissionDeniedException
IOException
FileNotFoundException
renameFile
public void renameFile(String oldpath,
String newpath)
throws PermissionDeniedException,
FileNotFoundException,
IOException
- Specified by:
renameFile in interface FileSystem
- Throws:
PermissionDeniedException
FileNotFoundException
IOException
getDefaultPath
public String getDefaultPath()
- Specified by:
getDefaultPath in interface FileSystem
removeDirectory
public void removeDirectory(String path)
throws PermissionDeniedException,
FileNotFoundException,
IOException
- Specified by:
removeDirectory in interface FileSystem
- Throws:
PermissionDeniedException
FileNotFoundException
IOException
setFileAttributes
public void setFileAttributes(String path,
SftpFileAttributes attrs)
throws PermissionDeniedException,
IOException,
FileNotFoundException
- Specified by:
setFileAttributes in interface FileSystem
- Throws:
PermissionDeniedException
IOException
FileNotFoundException
setFileAttributes
public void setFileAttributes(byte[] handle,
SftpFileAttributes attrs)
throws PermissionDeniedException,
IOException,
InvalidHandleException
- Specified by:
setFileAttributes in interface FileSystem
- Throws:
PermissionDeniedException
IOException
InvalidHandleException
readSymbolicLink
public SftpFile readSymbolicLink(String path)
throws UnsupportedFileOperationException,
FileNotFoundException,
IOException,
PermissionDeniedException
- Specified by:
readSymbolicLink in interface FileSystem
- Throws:
UnsupportedFileOperationException
FileNotFoundException
IOException
PermissionDeniedException
createSymbolicLink
public void createSymbolicLink(String link,
String target)
throws UnsupportedFileOperationException,
FileNotFoundException,
IOException,
PermissionDeniedException
- Specified by:
createSymbolicLink in interface FileSystem
- Throws:
UnsupportedFileOperationException
FileNotFoundException
IOException
PermissionDeniedException
fileExists
public boolean fileExists(String path)
throws IOException
- Specified by:
fileExists in interface FileSystem
- Throws:
IOException
getRealPath
public String getRealPath(String path)
throws IOException,
FileNotFoundException
- Specified by:
getRealPath in interface FileSystem
- Throws:
IOException
FileNotFoundException
getPathForHandle
public String getPathForHandle(byte[] handle)
throws InvalidHandleException
- Specified by:
getPathForHandle in interface FileSystem
- Throws:
InvalidHandleException
Copyright © 2012. All Rights Reserved.