Package org.apache.hadoop.fs.ftp
Class FTPFileSystem
java.lang.Object
org.apache.hadoop.conf.Configured
org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.ftp.FTPFileSystem
- All Implemented Interfaces:
Closeable,AutoCloseable,Configurable,BulkDeleteSource,org.apache.hadoop.fs.PathCapabilities,org.apache.hadoop.security.token.DelegationTokenIssuer
A FileSystem backed by an FTP client provided by Apache Commons Net.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.fs.FileSystem
org.apache.hadoop.fs.FileSystem.DirectoryEntries, org.apache.hadoop.fs.FileSystem.DirListingIterator<T extends FileStatus>, org.apache.hadoop.fs.FileSystem.Statistics -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final longstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final org.slf4j.LoggerFields inherited from class org.apache.hadoop.fs.FileSystem
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIXFields inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer
TOKEN_LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionappend(Path f, int bufferSize, Progressable progress) This optional operation is not yet supported.create(Path file, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) A stream obtained via this call must be closed before using other APIs of this class or else the invocation will block.booleanDelete a file.protected intGet the default port for this FTPFileSystem.getFileStatus(Path file) Return a file status object that represents the path.Return the current user's home directory in this FileSystem.Return the protocol scheme for the FileSystem.getUri()Returns a URI which identifies this FileSystem.Get the current working directory for the given FileSystemvoidinitialize(URI uri, Configuration conf) Initialize a FileSystem.listStatus(Path file) List the statuses of the files/directories in the given path if the path is a directory.booleanmkdirs(Path file, FsPermission permission) Make the given file and all non-existent parents into directories.Opens an FSDataInputStream at the indicated Path.booleanRenames Path src to Path dst.voidsetWorkingDirectory(Path newDir) Set the current working directory for the given FileSystem.Methods inherited from class org.apache.hadoop.fs.FileSystem
access, append, append, append, append, appendFile, areSymlinksEnabled, cancelDeleteOnExit, canonicalizeUri, checkPath, clearStatistics, close, closeAll, closeAllForUGI, completeLocalOutput, concat, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyFromLocalFile, copyToLocalFile, copyToLocalFile, copyToLocalFile, create, create, create, create, create, create, create, create, create, create, create, create, createBulkDelete, createDataInputStreamBuilder, createDataInputStreamBuilder, createDataOutputStreamBuilder, createFile, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createNonRecursive, createPathHandle, createSnapshot, createSnapshot, createSymlink, delete, deleteOnExit, deleteSnapshot, enableSymlinks, exists, fixRelativePart, get, get, get, getAclStatus, getAdditionalTokenIssuers, getAllStatistics, getAllStoragePolicies, getBlockSize, getCanonicalServiceName, getCanonicalUri, getChildFileSystems, getContentSummary, getDefaultBlockSize, getDefaultBlockSize, getDefaultReplication, getDefaultReplication, getDefaultUri, getDelegationToken, getEnclosingRoot, getFileBlockLocations, getFileBlockLocations, getFileChecksum, getFileChecksum, getFileLinkStatus, getFileSystemClass, getFSofPath, getGlobalStorageStatistics, getInitialWorkingDirectory, getLength, getLinkTarget, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getStoragePolicy, getStorageStatistics, getTrashRoot, getTrashRoots, getUsed, getUsed, getXAttr, getXAttrs, getXAttrs, globStatus, globStatus, hasPathCapability, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, listXAttrs, makeQualified, mkdirs, mkdirs, modifyAclEntries, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, msync, newInstance, newInstance, newInstance, newInstanceLocal, open, open, open, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setAcl, setDefaultUri, setDefaultUri, setOwner, setPermission, setQuota, setQuotaByStorageType, setReplication, setStoragePolicy, setTimes, setVerifyChecksum, setWriteChecksum, setXAttr, setXAttr, startLocalOutput, supportsSymlinks, truncate, unsetStoragePolicyMethods inherited from class org.apache.hadoop.conf.Configured
getConf, setConfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.security.token.DelegationTokenIssuer
addDelegationTokens
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE- See Also:
-
DEFAULT_BLOCK_SIZE
public static final int DEFAULT_BLOCK_SIZE- See Also:
-
DEFAULT_TIMEOUT
public static final long DEFAULT_TIMEOUT- See Also:
-
FS_FTP_USER_PREFIX
- See Also:
-
FS_FTP_HOST
- See Also:
-
FS_FTP_HOST_PORT
- See Also:
-
FS_FTP_PASSWORD_PREFIX
- See Also:
-
FS_FTP_DATA_CONNECTION_MODE
- See Also:
-
FS_FTP_TRANSFER_MODE
- See Also:
-
E_SAME_DIRECTORY_ONLY
- See Also:
-
FS_FTP_TIMEOUT
- See Also:
-
-
Constructor Details
-
FTPFileSystem
public FTPFileSystem()
-
-
Method Details
-
getScheme
Return the protocol scheme for the FileSystem.- Overrides:
getSchemein classFileSystem- Returns:
ftp
-
getDefaultPort
protected int getDefaultPort()Get the default port for this FTPFileSystem.- Overrides:
getDefaultPortin classFileSystem- Returns:
- the default port
-
initialize
Description copied from class:FileSystemInitialize a FileSystem. Called after the new FileSystem instance is constructed, and before it is ready for use. FileSystem implementations overriding this method MUST forward it to their superclass, though the order in which it is done, and whether to alter the configuration before the invocation are options of the subclass.- Overrides:
initializein classFileSystem- Parameters:
uri- a URI whose authority section names the host, port, etc. for this FileSystemconf- the configuration- Throws:
IOException- on any failure to initialize this instance.
-
open
Description copied from class:FileSystemOpens an FSDataInputStream at the indicated Path.- Specified by:
openin classFileSystem- Parameters:
file- the file name to openbufferSize- the size of the buffer to be used.- Returns:
- input stream.
- Throws:
IOException- IO failure
-
create
public FSDataOutputStream create(Path file, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws IOException A stream obtained via this call must be closed before using other APIs of this class or else the invocation will block.- Specified by:
createin classFileSystem- Parameters:
file- the file name to openpermission- file permissionoverwrite- if a file with this name already exists, then if true, the file will be overwritten, and if false an error will be thrown.bufferSize- the size of the buffer to be used.replication- required block replication for the file.blockSize- block sizeprogress- the progress reporter- Returns:
- output stream.
- Throws:
IOException- IO failure- See Also:
-
append
This optional operation is not yet supported.- Specified by:
appendin classFileSystem- Parameters:
f- the existing file to be appended.bufferSize- the size of the buffer to be used.progress- for reporting progress if it is not null.- Returns:
- output stream.
- Throws:
IOException- IO failure
-
delete
Description copied from class:FileSystemDelete a file.- Specified by:
deletein classFileSystem- Parameters:
file- the path to delete.recursive- if path is a directory and set to true, the directory is deleted else throws an exception. In case of a file the recursive can be set to either true or false.- Returns:
- true if delete is successful else false.
- Throws:
IOException- IO failure
-
getUri
Description copied from class:FileSystemReturns a URI which identifies this FileSystem.- Specified by:
getUriin classFileSystem- Returns:
- the URI of this filesystem.
-
listStatus
Description copied from class:FileSystemList the statuses of the files/directories in the given path if the path is a directory.Does not guarantee to return the List of files/directories status in a sorted order.
Will not return null. Expect IOException upon access error.
- Specified by:
listStatusin classFileSystem- Parameters:
file- given path- Returns:
- the statuses of the files/directories in the given patch
- Throws:
FileNotFoundException- when the path does not existIOException- see specific implementation
-
getFileStatus
Description copied from class:FileSystemReturn a file status object that represents the path.- Specified by:
getFileStatusin classFileSystem- Parameters:
file- The path we want information from- Returns:
- a FileStatus object
- Throws:
FileNotFoundException- when the path does not existIOException- see specific implementation
-
mkdirs
Description copied from class:FileSystemMake the given file and all non-existent parents into directories. Has roughly the semantics of Unix @{code mkdir -p}. Existence of the directory hierarchy is not an error.- Specified by:
mkdirsin classFileSystem- Parameters:
file- path to createpermission- to apply to f- Returns:
- if mkdir success true, not false.
- Throws:
IOException- IO failure
-
rename
Description copied from class:FileSystemRenames Path src to Path dst.- Specified by:
renamein classFileSystem- Parameters:
src- path to be renameddst- new path after rename- Returns:
- true if rename is successful
- Throws:
IOException- on failure
-
getWorkingDirectory
Description copied from class:FileSystemGet the current working directory for the given FileSystem- Specified by:
getWorkingDirectoryin classFileSystem- Returns:
- the directory pathname
-
getHomeDirectory
Description copied from class:FileSystemReturn the current user's home directory in this FileSystem. The default implementation returns"/user/$USER/".- Overrides:
getHomeDirectoryin classFileSystem- Returns:
- the path.
-
setWorkingDirectory
Description copied from class:FileSystemSet the current working directory for the given FileSystem. All relative paths will be resolved relative to it.- Specified by:
setWorkingDirectoryin classFileSystem- Parameters:
newDir- Path of new working directory
-