Class DefaultFileSystemExceptionFactory
- java.lang.Object
-
- com.github.robtimus.filesystems.ftp.DefaultFileSystemExceptionFactory
-
- All Implemented Interfaces:
FileSystemExceptionFactory
public class DefaultFileSystemExceptionFactory extends Object implements FileSystemExceptionFactory
A defaultFileSystemExceptionFactorythat always returns anFTPFileSystemExceptionunless specified otherwise.- Author:
- Rob Spoor
-
-
Constructor Summary
Constructors Constructor Description DefaultFileSystemExceptionFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileSystemExceptioncreateChangeWorkingDirectoryException(String directory, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a directory cannot be used as the current working directory.FileSystemExceptioncreateCopyException(String file, String other, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a file or directory cannot be copied.FileSystemExceptioncreateCreateDirectoryException(String directory, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a directory cannot be created.FileSystemExceptioncreateDeleteException(String file, int replyCode, String replyString, boolean isDirectory)Creates aFileSystemExceptionthat indicates a file or directory cannot be deleted.FileSystemExceptioncreateGetFileException(String file, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a file or directory cannot be retrieved.FileSystemExceptioncreateMoveException(String file, String other, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a file or directory cannot be moved.FileSystemExceptioncreateNewInputStreamException(String file, int replyCode, String replyString)Creates aFileSystemExceptionthat indicates a file cannot be opened for reading.FileSystemExceptioncreateNewOutputStreamException(String file, int replyCode, String replyString, Collection<? extends OpenOption> options)Creates aFileSystemExceptionthat indicates a file cannot be opened for writing.
-
-
-
Method Detail
-
createGetFileException
public FileSystemException createGetFileException(String file, int replyCode, String replyString)
Creates aFileSystemExceptionthat indicates a file or directory cannot be retrieved.Note that the LIST command is used to retrieve a file or directory. This will often return with a 226 code even if a file or directory cannot be retrieved. This does not mean that the LIST call was actually successful.
This default implementation does not return an
FTPFileSystemException, but aNoSuchFileExceptioninstead.- Specified by:
createGetFileExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file or directory.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
createChangeWorkingDirectoryException
public FileSystemException createChangeWorkingDirectoryException(String directory, int replyCode, String replyString)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a directory cannot be used as the current working directory.- Specified by:
createChangeWorkingDirectoryExceptionin interfaceFileSystemExceptionFactory- Parameters:
directory- A string identifying the directory.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
createCreateDirectoryException
public FileSystemException createCreateDirectoryException(String directory, int replyCode, String replyString)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a directory cannot be created.- Specified by:
createCreateDirectoryExceptionin interfaceFileSystemExceptionFactory- Parameters:
directory- A string identifying the directory.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
createDeleteException
public FileSystemException createDeleteException(String file, int replyCode, String replyString, boolean isDirectory)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a file or directory cannot be deleted.- Specified by:
createDeleteExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file or directory.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.isDirectory-trueif a directory cannot be deleted, orfalseif a file cannot be deleted.- Returns:
- The created
FileSystemException.
-
createNewInputStreamException
public FileSystemException createNewInputStreamException(String file, int replyCode, String replyString)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a file cannot be opened for reading.- Specified by:
createNewInputStreamExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
createNewOutputStreamException
public FileSystemException createNewOutputStreamException(String file, int replyCode, String replyString, Collection<? extends OpenOption> options)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a file cannot be opened for writing.- Specified by:
createNewOutputStreamExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.options- The open options used to open the file.- Returns:
- The created
FileSystemException.
-
createCopyException
public FileSystemException createCopyException(String file, String other, int replyCode, String replyString)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a file or directory cannot be copied.- Specified by:
createCopyExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file or directory to be copied.other- A string identifying the file or directory to be copied to.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
createMoveException
public FileSystemException createMoveException(String file, String other, int replyCode, String replyString)
Description copied from interface:FileSystemExceptionFactoryCreates aFileSystemExceptionthat indicates a file or directory cannot be moved.- Specified by:
createMoveExceptionin interfaceFileSystemExceptionFactory- Parameters:
file- A string identifying the file or directory to be moved.other- A string identifying the file or directory to be moved to.replyCode- The integer value of the reply code of the last FTP reply that triggered this method call.replyString- The entire text from the last FTP response that triggered this method call.- Returns:
- The created
FileSystemException.
-
-