org.apache.ftpserver.filesystem
Class NativeFileObject

java.lang.Object
  extended by org.apache.ftpserver.filesystem.NativeFileObject
All Implemented Interfaces:
FileObject

public class NativeFileObject
extends java.lang.Object
implements FileObject

This class wraps native file object.


Constructor Summary
protected NativeFileObject(java.lang.String fileName, java.io.File file, User user)
          Constructor.
 
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?
 java.lang.String getFullName()
          Get full name.
 java.lang.String getGroupName()
          Get group name
 long getLastModified()
          Get last modified time.
 int getLinkCount()
          Get link count
 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)
           
 java.lang.String getShortName()
          Get short name.
 long getSize()
          Get file size.
 boolean hasDeletePermission()
          Has delete permission.
 boolean hasReadPermission()
          Check read permission.
 boolean hasWritePermission()
          Check file write permission.
 boolean isDirectory()
          Is it a directory?
 boolean isFile()
          Is it a file?
 boolean isHidden()
          Is a hidden file?
 FileObject[] listFiles()
          List files.
 boolean mkdir()
          Create directory.
 boolean move(FileObject dest)
          Move file object.
static java.lang.String normalizeSeparateChar(java.lang.String pathName)
          Normalize separate character.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeFileObject

protected NativeFileObject(java.lang.String fileName,
                           java.io.File file,
                           User user)
Constructor.

Method Detail

getFullName

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

Specified by:
getFullName in interface FileObject

getShortName

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

Specified by:
getShortName in interface FileObject

isHidden

public boolean isHidden()
Is a hidden file?

Specified by:
isHidden in interface FileObject

isDirectory

public boolean isDirectory()
Is it a directory?

Specified by:
isDirectory in interface FileObject

isFile

public boolean isFile()
Is it a file?

Specified by:
isFile in interface FileObject

doesExist

public boolean doesExist()
Does this file exists?

Specified by:
doesExist in interface FileObject

getSize

public long getSize()
Get file size.

Specified by:
getSize in interface FileObject

getOwnerName

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

Specified by:
getOwnerName in interface FileObject

getGroupName

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

Specified by:
getGroupName in interface FileObject

getLinkCount

public int getLinkCount()
Get link count

Specified by:
getLinkCount in interface FileObject

getLastModified

public long getLastModified()
Get last modified time.

Specified by:
getLastModified in interface FileObject

hasReadPermission

public boolean hasReadPermission()
Check read permission.

Specified by:
hasReadPermission in interface FileObject

hasWritePermission

public boolean hasWritePermission()
Check file write permission.

Specified by:
hasWritePermission in interface FileObject

hasDeletePermission

public boolean hasDeletePermission()
Has delete permission.

Specified by:
hasDeletePermission in interface FileObject

delete

public boolean delete()
Delete file.

Specified by:
delete in interface FileObject

move

public boolean move(FileObject dest)
Move file object.

Specified by:
move in interface FileObject

mkdir

public boolean mkdir()
Create directory.

Specified by:
mkdir in interface FileObject

getPhysicalFile

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


listFiles

public FileObject[] listFiles()
List files. If not a directory or does not exist, null will be returned.

Specified by:
listFiles in interface FileObject

createOutputStream

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

Specified by:
createOutputStream in interface FileObject
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 FileObject
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)


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