Modifier and Type | Field and Description |
---|---|
protected FileSystemOptions |
fileSystemOptions
Authentication options.
|
Modifier | Constructor and Description |
---|---|
protected |
FTPClientWrapper(GenericFileName rootFileName,
FileSystemOptions fileSystemOptions)
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
abort()
Aborts the current operation.
|
OutputStream |
appendFileStream(String relPath)
Returns an OutputStream through which data can be written to append to a file on the server with the given name.
|
boolean |
completePendingCommand()
There are a few FTPClient methods that do not complete the entire sequence of FTP commands to complete a transaction.
|
protected org.apache.commons.net.ftp.FTPClient |
createClient(GenericFileName rootFileName,
UserAuthenticationData authData)
Creates an FTPClient.
|
boolean |
deleteFile(String relPath)
Deletes a file on the FTP server.
|
void |
disconnect()
Sends the FTP QUIT command to the server, receive the reply, and return the reply code.
|
FileSystemOptions |
getFileSystemOptions()
Gets the FileSystemOptions.
|
int |
getReplyCode()
Gets the integer value of the reply code of the last FTP reply.
|
String |
getReplyString()
Gets the entire text of the last FTP server response exactly as it was received, including all end of line markers in
NETASCII format.
|
GenericFileName |
getRoot()
Gets the root file name.
|
boolean |
hasFeature(String feature)
Queries the server for a supported feature.
|
boolean |
isConnected()
Tests if the client is currently connected to a server.
|
org.apache.commons.net.ftp.FTPFile[] |
listFiles(String relPath)
Using the default system autodetect mechanism, obtain a list of file information for the current working directory or
for just a single file.
|
boolean |
makeDirectory(String relPath)
Creates a new subdirectory on the FTP server in the current directory (if a relative pathname is given) or where
specified (if an absolute pathname is given).
|
Instant |
mdtmInstant(String relPath)
Sends the MDTM command to get a file's date and time information after file transfer.
|
boolean |
removeDirectory(String relPath)
Removes a directory on the FTP server (if empty).
|
boolean |
rename(String oldName,
String newName)
Renames a remote file.
|
InputStream |
retrieveFileStream(String relPath)
Returns an InputStream from which a named file from the server can be read.
|
InputStream |
retrieveFileStream(String relPath,
int bufferSize)
Returns an InputStream from which a named file from the server can be read.
|
InputStream |
retrieveFileStream(String relPath,
long restartOffset)
Returns an InputStream from which a named file from the server can be read.
|
void |
setBufferSize(int bufferSize)
Sets the buffer size for buffered data streams.
|
OutputStream |
storeFileStream(String relPath)
Returns an OutputStream through which data can be written to store a file on the server using the given name.
|
protected final FileSystemOptions fileSystemOptions
protected FTPClientWrapper(GenericFileName rootFileName, FileSystemOptions fileSystemOptions) throws FileSystemException
rootFileName
- the root file name.fileSystemOptions
- the file system options.FileSystemException
- if a file system error occurs.public boolean abort() throws IOException
FtpClient
abort
in interface FtpClient
IOException
- If an I/O error occurspublic OutputStream appendFileStream(String relPath) throws IOException
FtpClient
appendFileStream
in interface FtpClient
relPath
- The name of the remote file.IOException
- If an I/O error occurs.public boolean completePendingCommand() throws IOException
FtpClient
completePendingCommand
in interface FtpClient
IOException
- If an I/O error occurs.protected org.apache.commons.net.ftp.FTPClient createClient(GenericFileName rootFileName, UserAuthenticationData authData) throws FileSystemException
rootFileName
- the root file name.authData
- authentication data.FileSystemException
- if a file system error occurs.public boolean deleteFile(String relPath) throws IOException
FtpClient
deleteFile
in interface FtpClient
relPath
- The relPath of the file to be deleted.IOException
- If an I/O error occurs.public void disconnect() throws IOException
FtpClient
disconnect
in interface FtpClient
IOException
- If an I/O error occurs.public FileSystemOptions getFileSystemOptions()
public int getReplyCode() throws IOException
FtpClient
getReplyCode
in interface FtpClient
IOException
- If an I/O error occurs.public String getReplyString() throws IOException
FtpClient
getReplyString
in interface FtpClient
IOException
- If an I/O error occurs.public GenericFileName getRoot()
public boolean hasFeature(String feature) throws IOException
hasFeature
in interface FtpClient
feature
- the name of the feature, converted to upper case.true
if the feature is present, false
if the feature is not present or the FTP command
failed.IOException
- If an I/O error occurs.public boolean isConnected() throws FileSystemException
FtpClient
isConnected
in interface FtpClient
FileSystemException
- If an I/O error occurs.public org.apache.commons.net.ftp.FTPFile[] listFiles(String relPath) throws IOException
FtpClient
TODO This interface should not leak Apache Commons NET types like FTPFile
listFiles
in interface FtpClient
relPath
- The file or directory to list.IOException
- If an I/O error occurs.public boolean makeDirectory(String relPath) throws IOException
FtpClient
makeDirectory
in interface FtpClient
relPath
- The pathname of the directory to create.IOException
- If an I/O error occurs.public Instant mdtmInstant(String relPath) throws IOException
"LIST"
command response. Time values are always represented in UTC (GMT), and in the Gregorian
calendar regardless of what calendar may have been in use at the date and time the file was last modified.
NOTE: not all remote FTP servers support MDTM
.
mdtmInstant
in interface FtpClient
relPath
- The relative path of the file object to execute MDTM
command againstInstant
object containing the MDTM
timestamp.IOException
- If an I/O error occurs.public boolean removeDirectory(String relPath) throws IOException
FtpClient
removeDirectory
in interface FtpClient
relPath
- The pathname of the directory to remove.IOException
- If an I/O error occurs.public boolean rename(String oldName, String newName) throws IOException
FtpClient
rename
in interface FtpClient
oldName
- The name of the remote file to rename.newName
- The new name of the remote file.IOException
- If an I/O error occurs.public InputStream retrieveFileStream(String relPath) throws IOException
FtpClient
retrieveFileStream
in interface FtpClient
relPath
- The name of the remote file.IOException
- If an I/O error occurs.public InputStream retrieveFileStream(String relPath, int bufferSize) throws IOException
FtpClient
retrieveFileStream
in interface FtpClient
relPath
- The name of the remote file.bufferSize
- buffer size.IOException
- If an I/O error occurs.public InputStream retrieveFileStream(String relPath, long restartOffset) throws IOException
FtpClient
retrieveFileStream
in interface FtpClient
relPath
- The name of the remote file.restartOffset
- restart offset.IOException
- If an I/O error occurs.public void setBufferSize(int bufferSize) throws FileSystemException
FtpClient
setBufferSize
in interface FtpClient
bufferSize
- The size of the buffer.FileSystemException
- If an I/O error occurs.public OutputStream storeFileStream(String relPath) throws IOException
FtpClient
storeFileStream
in interface FtpClient
relPath
- The name to give the remote file.IOException
- If an I/O error occurs.Copyright © 2002–2025 The Apache Software Foundation. All rights reserved.