org.apache.ftpserver.filesystem.nativefs.impl
Class NativeFtpFile

java.lang.Object
  extended by org.apache.ftpserver.filesystem.nativefs.impl.NativeFtpFile
All Implemented Interfaces:
FtpFile

public class NativeFtpFile
extends java.lang.Object
implements FtpFile

Internal class, do not use directly. This class wraps native file object.

Author:
Apache MINA Project

Constructor Summary
protected NativeFtpFile(java.lang.String fileName, java.io.File file, User user)
          Constructor, internal do not use directly.
 
Method Summary
 java.io.InputStream createInputStream(long offset)
          Create input stream for reading.
 java.io.OutputStream createOutputStream(long offset)
          Create output stream for writing.
 boolean delete()
          Delete file.
 boolean doesExist()
          Does this file exists?
 boolean equals(java.lang.Object obj)
          Implements equals by comparing getCanonicalPath() for the underlying file instabnce.
 java.lang.String getAbsolutePath()
          Get full name.
 java.lang.String getGroupName()
          Get group name
 long getLastModified()
          Get last modified time.
 int getLinkCount()
          Get link count
 java.lang.String getName()
          Get short name.
 java.lang.String getOwnerName()
          Get file owner.
 java.io.File getPhysicalFile()
          Get the physical file object.
static java.lang.String getPhysicalName(java.lang.String rootDir, java.lang.String currDir, java.lang.String fileName)
          Get the physical canonical file name.
static java.lang.String getPhysicalName(java.lang.String rootDir, java.lang.String currDir, java.lang.String fileName, boolean caseInsensitive)
           
 long getSize()
          Get file size.
 int hashCode()
           
 boolean isDirectory()
          Is it a directory?
 boolean isFile()
          Is it a file?
 boolean isHidden()
          Is a hidden file?
 boolean isReadable()
          Check read permission.
 boolean isRemovable()
          Has delete permission.
 boolean isWritable()
          Check file write permission.
 java.util.List<FtpFile> listFiles()
          List files.
 boolean mkdir()
          Create directory.
 boolean move(FtpFile dest)
          Move file object.
static java.lang.String normalizeSeparateChar(java.lang.String pathName)
          Normalize separate character.
 boolean setLastModified(long time)
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeFtpFile

protected NativeFtpFile(java.lang.String fileName,
                        java.io.File file,
                        User user)
Constructor, internal do not use directly.

Method Detail

getAbsolutePath

public java.lang.String getAbsolutePath()
Get full name.

Specified by:
getAbsolutePath in interface FtpFile

getName

public java.lang.String getName()
Get short name.

Specified by:
getName in interface FtpFile

isHidden

public boolean isHidden()
Is a hidden file?

Specified by:
isHidden in interface FtpFile

isDirectory

public boolean isDirectory()
Is it a directory?

Specified by:
isDirectory in interface FtpFile

isFile

public boolean isFile()
Is it a file?

Specified by:
isFile in interface FtpFile

doesExist

public boolean doesExist()
Does this file exists?

Specified by:
doesExist in interface FtpFile

getSize

public long getSize()
Get file size.

Specified by:
getSize in interface FtpFile

getOwnerName

public java.lang.String getOwnerName()
Get file owner.

Specified by:
getOwnerName in interface FtpFile

getGroupName

public java.lang.String getGroupName()
Get group name

Specified by:
getGroupName in interface FtpFile

getLinkCount

public int getLinkCount()
Get link count

Specified by:
getLinkCount in interface FtpFile

getLastModified

public long getLastModified()
Get last modified time.

Specified by:
getLastModified in interface FtpFile

setLastModified

public boolean setLastModified(long time)

Specified by:
setLastModified in interface FtpFile

isReadable

public boolean isReadable()
Check read permission.

Specified by:
isReadable in interface FtpFile

isWritable

public boolean isWritable()
Check file write permission.

Specified by:
isWritable in interface FtpFile

isRemovable

public boolean isRemovable()
Has delete permission.

Specified by:
isRemovable in interface FtpFile

delete

public boolean delete()
Delete file.

Specified by:
delete in interface FtpFile

move

public boolean move(FtpFile dest)
Move file object.

Specified by:
move in interface FtpFile

mkdir

public boolean mkdir()
Create directory.

Specified by:
mkdir in interface FtpFile

getPhysicalFile

public java.io.File getPhysicalFile()
Get the physical file object.


listFiles

public java.util.List<FtpFile> listFiles()
List files. If not a directory or does not exist, null will be returned.

Specified by:
listFiles in interface FtpFile

createOutputStream

public java.io.OutputStream createOutputStream(long offset)
                                        throws java.io.IOException
Create output stream for writing.

Specified by:
createOutputStream in interface FtpFile
Throws:
java.io.IOException

createInputStream

public java.io.InputStream createInputStream(long offset)
                                      throws java.io.IOException
Create input stream for reading.

Specified by:
createInputStream in interface FtpFile
Throws:
java.io.IOException

normalizeSeparateChar

public static final java.lang.String normalizeSeparateChar(java.lang.String pathName)
Normalize separate character. Separate character should be '/' always.


getPhysicalName

public static final java.lang.String getPhysicalName(java.lang.String rootDir,
                                                     java.lang.String currDir,
                                                     java.lang.String fileName)
Get the physical canonical file name. It works like File.getCanonicalPath().

Parameters:
rootDir - The root directory.
currDir - The current directory. It will always be with respect to the root directory.
fileName - The input file name.
Returns:
The return string will always begin with the root directory. It will never be null.

getPhysicalName

public static final java.lang.String getPhysicalName(java.lang.String rootDir,
                                                     java.lang.String currDir,
                                                     java.lang.String fileName,
                                                     boolean caseInsensitive)

equals

public boolean equals(java.lang.Object obj)
Implements equals by comparing getCanonicalPath() for the underlying file instabnce. Ignores the fileName and User fields

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object


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