java.io.Closeable, java.lang.AutoCloseable, Configurable, BulkDeleteSource, PathCapabilities, DelegationTokenIssuer@Public @Stable public class FTPFileSystem extends FileSystem
A FileSystem backed by an FTP client provided by Apache Commons Net.
FileSystem.DirectoryEntries, FileSystem.DirListingIterator<T extends FileStatus>, FileSystem.Statistics| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_BLOCK_SIZE |
|
static int |
DEFAULT_BUFFER_SIZE |
|
static long |
DEFAULT_TIMEOUT |
|
static java.lang.String |
E_SAME_DIRECTORY_ONLY |
|
static java.lang.String |
FS_FTP_DATA_CONNECTION_MODE |
|
static java.lang.String |
FS_FTP_HOST |
|
static java.lang.String |
FS_FTP_HOST_PORT |
|
static java.lang.String |
FS_FTP_PASSWORD_PREFIX |
|
static java.lang.String |
FS_FTP_TIMEOUT |
|
static java.lang.String |
FS_FTP_TRANSFER_MODE |
|
static java.lang.String |
FS_FTP_USER_PREFIX |
|
static org.slf4j.Logger |
LOG |
DEFAULT_FS, FS_DEFAULT_NAME_KEY, SHUTDOWN_HOOK_PRIORITY, statistics, TRASH_PREFIX, USER_HOME_PREFIXTOKEN_LOG| Constructor | Description |
|---|---|
FTPFileSystem() |
| Modifier and Type | Method | Description |
|---|---|---|
FSDataOutputStream |
append(Path f,
int bufferSize,
Progressable progress) |
This optional operation is not yet supported.
|
FSDataOutputStream |
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.
|
boolean |
delete(Path file,
boolean recursive) |
Delete a file.
|
protected int |
getDefaultPort() |
Get the default port for this FTPFileSystem.
|
FileStatus |
getFileStatus(Path file) |
Return a file status object that represents the path.
|
Path |
getHomeDirectory() |
Return the current user's home directory in this FileSystem.
|
java.lang.String |
getScheme() |
Return the protocol scheme for the FileSystem.
|
java.net.URI |
getUri() |
Returns a URI which identifies this FileSystem.
|
Path |
getWorkingDirectory() |
Get the current working directory for the given FileSystem
|
void |
initialize(java.net.URI uri,
Configuration conf) |
Initialize a FileSystem.
|
FileStatus[] |
listStatus(Path file) |
List the statuses of the files/directories in the given path if the path is
a directory.
|
boolean |
mkdirs(Path file,
FsPermission permission) |
Make the given file and all non-existent parents into
directories.
|
FSDataInputStream |
open(Path file,
int bufferSize) |
Opens an FSDataInputStream at the indicated Path.
|
boolean |
rename(Path src,
Path dst) |
Renames Path src to Path dst.
|
void |
setWorkingDirectory(Path newDir) |
Set the current working directory for the given 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, createFid, createFile, createMultipartUploader, createNewFile, createNonRecursive, createNonRecursive, createNonRecursive, createPathHandle, createPathId, createSnapshot, createSnapshot, createSymlink, delete, deleteFid, 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, getJobTrackerAddrs, getLength, getLinkTarget, getLocal, getName, getNamed, getPathHandle, getQuotaUsage, getReplication, getServerDefaults, getServerDefaults, getStatistics, getStatistics, getStatus, getStatus, getStoragePolicy, getStorageStatistics, getTrashRoot, getTrashRoots, getUsed, getUsed, getXAttr, getXAttrs, getXAttrs, getZkConnectString, globStatus, globStatus, hasPathCapability, isDirectory, isFile, listCorruptFileBlocks, listFiles, listLocatedStatus, listLocatedStatus, listStatus, listStatus, listStatus, listStatusBatch, listStatusIterator, listXAttrs, makeQualified, mkdirs, mkdirs, mkdirsFid, mkdirsFid, modifyAclEntries, moveFromLocalFile, moveFromLocalFile, moveToLocalFile, msync, newInstance, newInstance, newInstance, newInstanceLocal, open, open, open, openFid, openFid, openFid2, openFile, openFile, openFileWithOptions, openFileWithOptions, primitiveCreate, primitiveMkdir, primitiveMkdir, printStatistics, processDeleteOnExit, removeAcl, removeAclEntries, removeDefaultAcl, removeXAttr, rename, renameSnapshot, resolveLink, resolvePath, satisfyStoragePolicy, setAcl, setDefaultUri, setDefaultUri, setOwner, setOwnerFid, setPermission, setQuota, setQuotaByStorageType, setReplication, setStoragePolicy, setTimes, setVerifyChecksum, setWriteChecksum, setXAttr, setXAttr, startLocalOutput, supportsSymlinks, truncate, unsetStoragePolicygetConf, setConfclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddDelegationTokenspublic static final org.slf4j.Logger LOG
public static final int DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BLOCK_SIZE
public static final long DEFAULT_TIMEOUT
public static final java.lang.String FS_FTP_USER_PREFIX
public static final java.lang.String FS_FTP_HOST
public static final java.lang.String FS_FTP_HOST_PORT
public static final java.lang.String FS_FTP_PASSWORD_PREFIX
public static final java.lang.String FS_FTP_DATA_CONNECTION_MODE
public static final java.lang.String FS_FTP_TRANSFER_MODE
public static final java.lang.String E_SAME_DIRECTORY_ONLY
public static final java.lang.String FS_FTP_TIMEOUT
public java.lang.String getScheme()
getScheme in class FileSystemftpprotected int getDefaultPort()
getDefaultPort in class FileSystempublic void initialize(java.net.URI uri,
Configuration conf)
throws java.io.IOException
FileSysteminitialize in class FileSystemuri - a URI whose authority section names the host, port, etc.
for this FileSystemconf - the configurationjava.io.IOException - on any failure to initialize this instance.public FSDataInputStream open(Path file, int bufferSize) throws java.io.IOException
FileSystemopen in class FileSystemfile - the file name to openbufferSize - the size of the buffer to be used.java.io.IOException - IO failurepublic FSDataOutputStream create(Path file, FsPermission permission, boolean overwrite, int bufferSize, short replication, long blockSize, Progressable progress) throws java.io.IOException
create in class FileSystemfile - 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 reporterjava.io.IOException - IO failureFileSystem.setPermission(Path, FsPermission)public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws java.io.IOException
append in class FileSystemf - the existing file to be appended.bufferSize - the size of the buffer to be used.progress - for reporting progress if it is not null.java.io.IOException - IO failurepublic boolean delete(Path file, boolean recursive) throws java.io.IOException
FileSystemdelete in class FileSystemfile - 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.java.io.IOException - IO failurepublic java.net.URI getUri()
FileSystemgetUri in class FileSystempublic FileStatus[] listStatus(Path file) throws java.io.IOException
FileSystemDoes not guarantee to return the List of files/directories status in a sorted order.
Will not return null. Expect IOException upon access error.
listStatus in class FileSystemfile - given pathjava.io.FileNotFoundException - when the path does not existjava.io.IOException - see specific implementationpublic FileStatus getFileStatus(Path file) throws java.io.IOException
FileSystemgetFileStatus in class FileSystemfile - The path we want information fromjava.io.FileNotFoundException - when the path does not existjava.io.IOException - see specific implementationpublic boolean mkdirs(Path file, FsPermission permission) throws java.io.IOException
FileSystemmkdirs in class FileSystemfile - path to createpermission - to apply to fjava.io.IOException - IO failurepublic boolean rename(Path src, Path dst) throws java.io.IOException
FileSystemrename in class FileSystemsrc - path to be renameddst - new path after renamejava.io.IOException - on failurepublic Path getWorkingDirectory()
FileSystemgetWorkingDirectory in class FileSystempublic Path getHomeDirectory()
FileSystem"/user/$USER/".getHomeDirectory in class FileSystempublic void setWorkingDirectory(Path newDir)
FileSystemsetWorkingDirectory in class FileSystemnewDir - Path of new working directoryCopyright © 2008–2025 Apache Software Foundation. All rights reserved.