public class DefaultFileSystemExceptionFactory extends Object implements FileSystemExceptionFactory
FileSystemExceptionFactory
that will return a NoSuchFileException
if the id
of the
SftpException
is ChannelSftp.SSH_FX_NO_SUCH_FILE
, an AccessDeniedException
if it's
ChannelSftp.SSH_FX_PERMISSION_DENIED
, or a FileSystemException
otherwise, unless specified otherwise.Constructor and Description |
---|
DefaultFileSystemExceptionFactory() |
Modifier and Type | Method and Description |
---|---|
FileSystemException |
createChangeWorkingDirectoryException(String directory,
SftpException exception)
Creates a
FileSystemException that indicates a directory cannot be used as the current working directory. |
FileSystemException |
createCopyException(String file,
String other,
SftpException exception)
Creates a
FileSystemException that indicates a file or directory cannot be copied. |
FileSystemException |
createCreateDirectoryException(String directory,
SftpException exception)
Creates a
FileSystemException that indicates a directory cannot be created. |
FileSystemException |
createDeleteException(String file,
SftpException exception,
boolean isDirectory)
Creates a
FileSystemException that indicates a file or directory cannot be deleted. |
FileSystemException |
createGetFileException(String file,
SftpException exception)
Creates a
FileSystemException that indicates a file or directory cannot be retrieved. |
FileSystemException |
createListFilesException(String directory,
SftpException exception)
Creates a
FileSystemException that indicates the contents of a directory cannot be retrieved. |
FileSystemException |
createMoveException(String file,
String other,
SftpException exception)
Creates a
FileSystemException that indicates a file or directory cannot be moved. |
FileSystemException |
createNewInputStreamException(String file,
SftpException exception)
Creates a
FileSystemException that indicates a file cannot be opened for reading. |
FileSystemException |
createNewOutputStreamException(String file,
SftpException exception,
Collection<? extends OpenOption> options)
Creates a
FileSystemException that indicates a file cannot be opened for writing. |
FileSystemException |
createReadLinkException(String link,
SftpException exception)
Creates a
FileSystemException that indicates a symbolic link cannot be read. |
FileSystemException |
createSetGroupException(String file,
SftpException exception)
Creates a
FileSystemException that indicates the group of a file or directory cannot be set. |
FileSystemException |
createSetModificationTimeException(String file,
SftpException exception)
Creates a
FileSystemException that indicates the modification time of a file or directory cannot be set. |
FileSystemException |
createSetOwnerException(String file,
SftpException exception)
Creates a
FileSystemException that indicates the owner of a file or directory cannot be set. |
FileSystemException |
createSetPermissionsException(String file,
SftpException exception)
Creates a
FileSystemException that indicates the permissions of a file or directory cannot be set. |
public FileSystemException createGetFileException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a file or directory cannot be retrieved.createGetFileException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createReadLinkException(String link, SftpException exception)
FileSystemException
that indicates a symbolic link cannot be read.
If the id
of the SftpException
is not ChannelSftp.SSH_FX_NO_SUCH_FILE
or
ChannelSftp.SSH_FX_PERMISSION_DENIED
, this default implementation does not return a FileSystemException
, but a
NotLinkException
instead.
createReadLinkException
in interface FileSystemExceptionFactory
link
- A string identifying the symbolic link.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createListFilesException(String directory, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates the contents of a directory cannot be retrieved.createListFilesException
in interface FileSystemExceptionFactory
directory
- A string identifying the directory.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createChangeWorkingDirectoryException(String directory, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a directory cannot be used as the current working directory.createChangeWorkingDirectoryException
in interface FileSystemExceptionFactory
directory
- A string identifying the directory.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createCreateDirectoryException(String directory, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a directory cannot be created.createCreateDirectoryException
in interface FileSystemExceptionFactory
directory
- A string identifying the directory.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createDeleteException(String file, SftpException exception, boolean isDirectory)
FileSystemExceptionFactory
FileSystemException
that indicates a file or directory cannot be deleted.createDeleteException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory.exception
- The SftpException
that was thrown.isDirectory
- true
if a directory cannot be deleted, or false
if a file cannot be deleted.FileSystemException
.public FileSystemException createNewInputStreamException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a file cannot be opened for reading.createNewInputStreamException
in interface FileSystemExceptionFactory
file
- A string identifying the file.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createNewOutputStreamException(String file, SftpException exception, Collection<? extends OpenOption> options)
FileSystemExceptionFactory
FileSystemException
that indicates a file cannot be opened for writing.createNewOutputStreamException
in interface FileSystemExceptionFactory
file
- A string identifying the file.exception
- The SftpException
that was thrown.options
- The open options used to open the file.FileSystemException
.public FileSystemException createCopyException(String file, String other, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a file or directory cannot be copied.createCopyException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to be copied.other
- A string identifying the file or directory to be copied to.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createMoveException(String file, String other, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates a file or directory cannot be moved.createMoveException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to be moved.other
- A string identifying the file or directory to be moved to.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createSetOwnerException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates the owner of a file or directory cannot be set.createSetOwnerException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to set the owner of.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createSetGroupException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates the group of a file or directory cannot be set.createSetGroupException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to set the group of.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createSetPermissionsException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates the permissions of a file or directory cannot be set.createSetPermissionsException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to set the permissions of.exception
- The SftpException
that was thrown.FileSystemException
.public FileSystemException createSetModificationTimeException(String file, SftpException exception)
FileSystemExceptionFactory
FileSystemException
that indicates the modification time of a file or directory cannot be set.createSetModificationTimeException
in interface FileSystemExceptionFactory
file
- A string identifying the file or directory to set the modification time of.exception
- The SftpException
that was thrown.FileSystemException
.Copyright © 2016–2023. All rights reserved.