org.apache.ftpserver.ftplet
Interface FtpFile

All Known Implementing Classes:
NativeFtpFile

public interface FtpFile

This is the file abstraction used by the server.

Author:
Apache MINA Project

Method Summary
 InputStream createInputStream(long offset)
          Create input stream for reading.
 OutputStream createOutputStream(long offset)
          Create output stream for writing.
 boolean delete()
          Delete file.
 boolean doesExist()
          Does this file exists?
 String getAbsolutePath()
          Get the full path from the base directory of the FileSystemView.
 String getGroupName()
          Get owner group name.
 long getLastModified()
          Get last modified time in UTC.
 int getLinkCount()
          Get link count.
 String getName()
          Get the file name of the file
 String getOwnerName()
          Get the owner name.
 long getSize()
          Get file size.
 boolean isDirectory()
          Is it a directory?
 boolean isFile()
          Is it a file?
 boolean isHidden()
          Is the file hidden?
 boolean isReadable()
          Has read permission?
 boolean isRemovable()
          Has delete permission?
 boolean isWritable()
          Has write permission?
 List<FtpFile> listFiles()
          List file objects.
 boolean mkdir()
          Create directory.
 boolean move(FtpFile destination)
          Move file.
 boolean setLastModified(long time)
          Set the last modified time stamp of a file
 

Method Detail

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:
true if the FtpFile is hidden

isDirectory

boolean isDirectory()
Is it a directory?

Returns:
true if the FtpFile is a directory

isFile

boolean isFile()
Is it a file?

Returns:
true if the FtpFile is a file, false if it is a directory

doesExist

boolean doesExist()
Does this file exists?

Returns:
true if the FtpFile exists

isReadable

boolean isReadable()
Has read permission?

Returns:
true if the FtpFile is readable by the user

isWritable

boolean isWritable()
Has write permission?

Returns:
true if the FtpFile is writable by the user

isRemovable

boolean isRemovable()
Has delete permission?

Returns:
true if the FtpFile is 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. See File.setLastModified(long).

getSize

long getSize()
Get file size.

Returns:
The size of the FtpFile in bytes

mkdir

boolean mkdir()
Create directory.

Returns:
true if the operation was successful

delete

boolean delete()
Delete file.

Returns:
true if the operation was successful

move

boolean move(FtpFile destination)
Move file.

Parameters:
destination - The target FtpFile to move the current FtpFile to
Returns:
true if the operation was successful

listFiles

List<FtpFile> 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.

Returns:
The List of FtpFiles

createOutputStream

OutputStream createOutputStream(long offset)
                                throws IOException
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 OutputStream used to write to the FtpFile
Throws:
IOException

createInputStream

InputStream createInputStream(long offset)
                              throws IOException
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 InputStream used to read the FtpFile
Throws:
IOException


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.