Package org.apache.ftpserver.ftplet
Interface FtpFile
public interface FtpFile
This is the file abstraction used by the server.
- Author:
- Apache MINA Project
-
Method Summary
Modifier and TypeMethodDescriptioncreateInputStream(long offset) Create input stream for reading.createOutputStream(long offset) Create output stream for writing.booleandelete()Delete file.booleanDoes this file exists?Get the full path from the base directory of the FileSystemView.Get owner group name.longGet last modified time in UTC.intGet link count.getName()Get the file name of the file.Get the owner name.Returns the physical location or path of the file.longgetSize()Get file size.booleanIs it a directory?booleanisFile()Is it a file?booleanisHidden()Is the file hidden?booleanHas read permission?booleanHas delete permission?booleanHas write permission?List file objects.booleanmkdir()Create directory.booleanMove file.booleansetLastModified(long time) Set the last modified time stamp of a file.
-
Method Details
-
getAbsolutePath
String getAbsolutePath()Get the full path from the base directory of the FileSystemView.- Returns:
- a path where the path separator is '/' (even if the operating system uses another character as path separator).
-
getName
String getName()Get the file name of the file.- Returns:
- the last part of the file path (the part after the last '/').
-
isHidden
boolean isHidden()Is the file hidden?- Returns:
trueif theFtpFileis hidden
-
isDirectory
boolean isDirectory()Is it a directory?- Returns:
trueif theFtpFileis a directory
-
isFile
boolean isFile()Is it a file?- Returns:
trueif theFtpFileis a file,falseif it is a directory
-
doesExist
boolean doesExist()Does this file exists?- Returns:
trueif theFtpFileexists
-
isReadable
boolean isReadable()Has read permission?- Returns:
trueif theFtpFileis readable by the user
-
isWritable
boolean isWritable()Has write permission?- Returns:
trueif theFtpFileis writable by the user
-
isRemovable
boolean isRemovable()Has delete permission?- Returns:
trueif theFtpFileis removable by the user
-
getOwnerName
String getOwnerName()Get the owner name.- Returns:
- The name of the owner of the
FtpFile
-
getGroupName
String getGroupName()Get owner group name.- Returns:
- The name of the group that owns the
FtpFile
-
getLinkCount
int getLinkCount()Get link count.- Returns:
- The number of links for the
FtpFile
-
getLastModified
long getLastModified()Get last modified time in UTC.- Returns:
- The timestamp of the last modified time for the
FtpFile
-
setLastModified
boolean setLastModified(long time) Set the last modified time stamp of a file.- Parameters:
time- The last modified time, in milliseconds since the epoch. SeeFile.setLastModified(long).- Returns:
trueif and only if the operation succeeded;falseotherwise
-
getSize
long getSize()Get file size.- Returns:
- The size of the
FtpFilein bytes
-
getPhysicalFile
Object getPhysicalFile()Returns the physical location or path of the file. It is completely up to the implementation to return appropriate value based on the file system implementation.- Returns:
- the physical location or path of the file.
-
mkdir
boolean mkdir()Create directory.- Returns:
trueif the operation was successful
-
delete
boolean delete()Delete file.- Returns:
trueif the operation was successful
-
move
Move file. -
listFiles
List file objects. If not a directory or does not exist, null will be returned. Files must be returned in alphabetical order. List must be immutable. -
createOutputStream
Create output stream for writing.- Parameters:
offset- The number of bytes at where to start writing. If the file is not random accessible, any offset other than zero will throw an exception.- Returns:
- An
OutputStreamused to write to theFtpFile - Throws:
IOException- If the OutputStream creation failed
-
createInputStream
Create input stream for reading.- Parameters:
offset- The number of bytes of where to start reading. If the file is not random accessible, any offset other than zero will throw an exception.- Returns:
- An
InputStreamused to read theFtpFile - Throws:
IOException- If the InputStream creation failed
-