Package com.sshtools.common.sftp
Class AbstractFileSystem
java.lang.Object
com.sshtools.common.sftp.AbstractFileSystem
This class is final. It may not be extended.
- Author:
- Lee David Painter
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final intstatic final intstatic final intstatic final intprotected AbstractFileFactory<?>static final intFile open flag, forces all writes to append data at the end of the file.static final intFile open flag, if specified a new file will be created if one does not already exist.static final intFile open flag, causes an open request to fail if the named file already exists.static final intFile open flag, opens the file for reading.static final intIndicates the server should treat the file as text and convert it to the canoncial newline convention in use.static final intFile open flag, forces an existing file with the same name to be truncated to zero length when creating a file by specifying OPEN_CREATE.static final intFile open flag, opens the file for writing.protected Map<String,AbstractFileSystem.OpenDirectory> static final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckOpenFlagsAndFileState(String path, com.sshtools.common.util.UnsignedInteger32 flags, AbstractFile f) Deprecated.voidcloseFile(byte[] handle) voidvoidvoidcopyData(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, com.sshtools.common.util.UnsignedInteger64 length, byte[] toHandle, com.sshtools.common.util.UnsignedInteger64 toOffset) voidvoidcreateLink(String link, String target) voidcreateSymbolicLink(String link, String target) booleanfileExists(String path) booleanfileExists(String path, boolean followLinks) voidfreeHandle(byte[] handle) getFileAttributes(byte[] handle) getFileAttributes(String path) getFileAttributes(String path, boolean followSymlinks) getFileForHandle(byte[] handle) getPathForHandle(byte[] handle) getRealPath(String path) handleToString(byte[] b) voidinit(SshConnection con, String protocolInUse) booleanbooleanmakeDirectory(String path, SftpFileAttributes attrs) byte[]openDirectory(String path) byte[]openDirectory(String path, SftpFileFilter filter) byte[]openFile(String path, com.sshtools.common.util.UnsignedInteger32 flags, SftpFileAttributes attrs) Deprecated.byte[]openFile(String path, com.sshtools.common.util.UnsignedInteger32 flags, Optional<com.sshtools.common.util.UnsignedInteger32> accessFlags, SftpFileAttributes attrs) byte[]voidpopulateEvent(Event evt) SftpFile[]readDirectory(byte[] handle) intreadFile(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, byte[] buf, int start, int numBytesToRead) readSymbolicLink(String link) voidremoveDirectory(String path) voidremoveFile(String path) voidrenameFile(String oldpath, String newpath) protected AbstractFileresolveFile(String path, SshConnection con) voidsetFileAttributes(byte[] handle, SftpFileAttributes attrs) voidsetFileAttributes(String path, SftpFileAttributes attrs) startMultipartUpload(AbstractFile targetFile) byte[]stringToHandle(String handle) voidwriteFile(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, byte[] data, int off, int len)
-
Field Details
-
OPEN_READ
public static final int OPEN_READFile open flag, opens the file for reading.- See Also:
-
OPEN_WRITE
public static final int OPEN_WRITEFile open flag, opens the file for writing.- See Also:
-
OPEN_APPEND
public static final int OPEN_APPENDFile open flag, forces all writes to append data at the end of the file.- See Also:
-
OPEN_CREATE
public static final int OPEN_CREATEFile open flag, if specified a new file will be created if one does not already exist.- See Also:
-
OPEN_TRUNCATE
public static final int OPEN_TRUNCATEFile open flag, forces an existing file with the same name to be truncated to zero length when creating a file by specifying OPEN_CREATE.- See Also:
-
OPEN_EXCLUSIVE
public static final int OPEN_EXCLUSIVEFile open flag, causes an open request to fail if the named file already exists. OPEN_CREATE must also be specified if this flag is used.- See Also:
-
OPEN_TEXT
public static final int OPEN_TEXTIndicates the server should treat the file as text and convert it to the canoncial newline convention in use.- See Also:
-
BLOCK_READ
public static final int BLOCK_READ- See Also:
-
BLOCK_WRITE
public static final int BLOCK_WRITE- See Also:
-
BLOCK_DELETE
public static final int BLOCK_DELETE- See Also:
-
BLOCK_ADVISORY
public static final int BLOCK_ADVISORY- See Also:
-
AUTHORIZED_KEYS_STORE
- See Also:
-
SFTP
- See Also:
-
SCP
- See Also:
-
SHELL
- See Also:
-
openFiles
-
openDirectories
-
fileFactory
-
-
Constructor Details
-
AbstractFileSystem
public AbstractFileSystem(SshConnection con, String protocolInUse) throws IOException, PermissionDeniedException - Throws:
IOExceptionPermissionDeniedException
-
-
Method Details
-
getFileFactory
-
init
-
resolveFile
protected AbstractFile resolveFile(String path, SshConnection con) throws PermissionDeniedException, IOException - Throws:
PermissionDeniedExceptionIOException
-
closeFilesystem
public void closeFilesystem() -
makeDirectory
public boolean makeDirectory(String path, SftpFileAttributes attrs) throws PermissionDeniedException, FileNotFoundException, IOException -
getFileAttributes
public SftpFileAttributes getFileAttributes(byte[] handle) throws IOException, InvalidHandleException, PermissionDeniedException -
getFileAttributes
public SftpFileAttributes getFileAttributes(String path) throws FileNotFoundException, IOException, PermissionDeniedException -
getFileAttributes
public SftpFileAttributes getFileAttributes(String path, boolean followSymlinks) throws IOException, FileNotFoundException, PermissionDeniedException -
openDirectory
public byte[] openDirectory(String path) throws PermissionDeniedException, FileNotFoundException, IOException -
openDirectory
public byte[] openDirectory(String path, SftpFileFilter filter) throws PermissionDeniedException, FileNotFoundException, IOException -
stringToHandle
-
handleToString
-
readDirectory
public SftpFile[] readDirectory(byte[] handle) throws InvalidHandleException, EOFException, IOException, PermissionDeniedException -
openFile
@Deprecated(since="3.1.0") public byte[] openFile(String path, com.sshtools.common.util.UnsignedInteger32 flags, SftpFileAttributes attrs) throws PermissionDeniedException, FileNotFoundException, IOException Deprecated. -
openFile
public byte[] openFile(String path, com.sshtools.common.util.UnsignedInteger32 flags, Optional<com.sshtools.common.util.UnsignedInteger32> accessFlags, SftpFileAttributes attrs) throws PermissionDeniedException, FileNotFoundException, IOException -
checkOpenFlagsAndFileState
@Deprecated protected void checkOpenFlagsAndFileState(String path, com.sshtools.common.util.UnsignedInteger32 flags, AbstractFile f) throws IOException, PermissionDeniedException, FileNotFoundException Deprecated. -
readFile
public int readFile(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, byte[] buf, int start, int numBytesToRead) throws InvalidHandleException, EOFException, IOException, PermissionDeniedException -
writeFile
public void writeFile(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, byte[] data, int off, int len) throws InvalidHandleException, IOException, PermissionDeniedException -
closeFile
- Throws:
InvalidHandleExceptionIOException
-
freeHandle
public void freeHandle(byte[] handle) -
closeFile
- Throws:
InvalidHandleExceptionIOException
-
getVolume
- Throws:
IOExceptionPermissionDeniedException
-
removeFile
public void removeFile(String path) throws PermissionDeniedException, IOException, FileNotFoundException -
renameFile
public void renameFile(String oldpath, String newpath) throws PermissionDeniedException, FileNotFoundException, IOException -
copyFile
public void copyFile(String oldpath, String newpath, boolean overwrite) throws PermissionDeniedException, FileNotFoundException, FileAlreadyExistsException, IOException -
getDefaultPath
- Throws:
IOExceptionPermissionDeniedException
-
removeDirectory
public void removeDirectory(String path) throws PermissionDeniedException, FileNotFoundException, IOException -
setFileAttributes
public void setFileAttributes(String path, SftpFileAttributes attrs) throws PermissionDeniedException, IOException, FileNotFoundException -
setFileAttributes
public void setFileAttributes(byte[] handle, SftpFileAttributes attrs) throws PermissionDeniedException, IOException, InvalidHandleException -
readSymbolicLink
public SftpFile readSymbolicLink(String link) throws UnsupportedFileOperationException, FileNotFoundException, IOException, PermissionDeniedException -
createSymbolicLink
public void createSymbolicLink(String link, String target) throws UnsupportedFileOperationException, FileNotFoundException, IOException, PermissionDeniedException -
createLink
public void createLink(String link, String target) throws UnsupportedFileOperationException, FileNotFoundException, IOException, PermissionDeniedException -
fileExists
- Throws:
IOExceptionPermissionDeniedException
-
fileExists
public boolean fileExists(String path, boolean followLinks) throws IOException, PermissionDeniedException - Throws:
IOExceptionPermissionDeniedException
-
getRealPath
public String getRealPath(String path) throws IOException, FileNotFoundException, PermissionDeniedException -
getFileForHandle
- Throws:
IOExceptionInvalidHandleException
-
populateEvent
-
getConnection
-
getPathForHandle
- Throws:
IOExceptionInvalidHandleException
-
copyData
public void copyData(byte[] handle, com.sshtools.common.util.UnsignedInteger64 offset, com.sshtools.common.util.UnsignedInteger64 length, byte[] toHandle, com.sshtools.common.util.UnsignedInteger64 toOffset) throws IOException, PermissionDeniedException, InvalidHandleException -
isMultipartTransferSupported
public boolean isMultipartTransferSupported(String path) throws PermissionDeniedException, IOException - Throws:
PermissionDeniedExceptionIOException
-
startMultipartUpload
public MultipartTransfer startMultipartUpload(AbstractFile targetFile) throws PermissionDeniedException, IOException - Throws:
PermissionDeniedExceptionIOException
-
openPart
- Throws:
IOExceptionPermissionDeniedException
-