edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.net.ftp
Class FTPFile

java.lang.Object
  extended by com.enterprisedt.net.ftp.FTPFile

public class FTPFile
extends java.lang.Object

Represents a remote file (implementation)

Version:
$Revision: 1.20 $
Author:
Bruce Blackshaw

Field Summary
protected  java.util.Date created
          Created time
protected static java.lang.String cvsId
          Revision control id
protected  java.lang.String group
          Group if known
protected  boolean isDir
          Is this a directory?
protected  boolean isLink
          Is this file a symbolic link?
protected  java.util.Date lastModified
          Last modified
protected  int linkCount
          Number of links to file
protected  java.lang.String linkedname
          Name of file this is linked to
protected  java.lang.String name
          File/dir name
protected  java.lang.String owner
          Owner if known
protected  java.lang.String path
          Directory if known
protected  java.lang.String permissions
          Permission bits string
protected  java.lang.String raw
          Raw string
protected  long size
          Size of file
static int UNIX
          UNIX type
static int UNKNOWN
          Unknown remote server type
static int VMS
          VMS type
static int WINDOWS
          Windows type
 
Constructor Summary
FTPFile(int type, java.lang.String raw, java.lang.String name, long size, boolean isDir, java.util.Date lastModified)
          Deprecated. 'type' no longer used.
FTPFile(java.lang.String raw)
          Constructor
FTPFile(java.lang.String raw, java.lang.String name, long size, boolean isDir, java.util.Date lastModified)
          Constructor
 
Method Summary
 java.util.Date created()
          Get the created date for the file.
 java.lang.String getGroup()
           
 int getLinkCount()
           
 java.lang.String getLinkedname()
          Deprecated.  
 java.lang.String getLinkedName()
           
 java.lang.String getName()
           
 java.lang.String getOwner()
           
 java.lang.String getPath()
           
 java.lang.String getPermissions()
           
 java.lang.String getRaw()
           
 int getType()
          Deprecated. No longer necessary.
 boolean isDir()
           
 boolean isFile()
          Is this a file (and not a directory or a link).
 boolean isLink()
           
 java.util.Date lastModified()
           
 FTPFile[] listFiles()
          Returns an array of FTPFile objects denoting the files and directories in this directory
 void setCreated(java.util.Date date)
          Set the created date
 void setDir(boolean isDir)
           
 void setGroup(java.lang.String group)
           
 void setLastModified(java.util.Date date)
          Set the last modified date
 void setLink(boolean isLink)
           
 void setLinkCount(int linkCount)
           
 void setLinkedName(java.lang.String linkedname)
           
 void setName(java.lang.String name)
          Set the name of the file
 void setOwner(java.lang.String owner)
           
 void setPath(java.lang.String path)
           
 void setPermissions(java.lang.String permissions)
           
 void setSize(long size)
           
 long size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

cvsId

protected static final java.lang.String cvsId
Revision control id

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
Unknown remote server type

See Also:
Constant Field Values

WINDOWS

public static final int WINDOWS
Windows type

See Also:
Constant Field Values

UNIX

public static final int UNIX
UNIX type

See Also:
Constant Field Values

VMS

public static final int VMS
VMS type

See Also:
Constant Field Values

isLink

protected boolean isLink
Is this file a symbolic link?


linkCount

protected int linkCount
Number of links to file


permissions

protected java.lang.String permissions
Permission bits string


isDir

protected boolean isDir
Is this a directory?


size

protected long size
Size of file


name

protected java.lang.String name
File/dir name


linkedname

protected java.lang.String linkedname
Name of file this is linked to


owner

protected java.lang.String owner
Owner if known


group

protected java.lang.String group
Group if known


lastModified

protected java.util.Date lastModified
Last modified


created

protected java.util.Date created
Created time


raw

protected java.lang.String raw
Raw string


path

protected java.lang.String path
Directory if known

Constructor Detail

FTPFile

public FTPFile(int type,
               java.lang.String raw,
               java.lang.String name,
               long size,
               boolean isDir,
               java.util.Date lastModified)
Deprecated. 'type' no longer used.

Constructor

Parameters:
type - type of file
raw - raw string returned from server
name - name of file
size - size of file
isDir - true if a directory
lastModified - last modified timestamp

FTPFile

public FTPFile(java.lang.String raw,
               java.lang.String name,
               long size,
               boolean isDir,
               java.util.Date lastModified)
Constructor

Parameters:
raw - raw string returned from server
name - name of file
size - size of file
isDir - true if a directory
lastModified - last modified timestamp

FTPFile

public FTPFile(java.lang.String raw)
Constructor

Parameters:
raw - raw string returned from server
Method Detail

listFiles

public FTPFile[] listFiles()
Returns an array of FTPFile objects denoting the files and directories in this directory

Returns:
FTPFile array

getType

public int getType()
Deprecated. No longer necessary.

Get the type of file, i.e UNIX

Returns:
the integer type of the file

getGroup

public java.lang.String getGroup()
Returns:
Returns the group.

isDir

public boolean isDir()
Returns:
Returns the isDir.

isFile

public boolean isFile()
Is this a file (and not a directory or a link).

Returns:
true if a file, false if link or directory

lastModified

public java.util.Date lastModified()
Returns:
Returns the lastModified date.

setLastModified

public void setLastModified(java.util.Date date)
Set the last modified date

Parameters:
date - last modified date

created

public java.util.Date created()
Get the created date for the file. This is not supported by many servers, e.g. Unix does not record the created date of a file.

Returns:
Returns the created date.

setCreated

public void setCreated(java.util.Date date)
Set the created date

Parameters:
date -

getName

public java.lang.String getName()
Returns:
Returns the name.

setName

public void setName(java.lang.String name)
Set the name of the file

Parameters:
name - name of file

getOwner

public java.lang.String getOwner()
Returns:
Returns the owner.

getRaw

public java.lang.String getRaw()
Returns:
Returns the raw server string.

size

public long size()
Returns:
Returns the size.

setSize

public void setSize(long size)

getPermissions

public java.lang.String getPermissions()
Returns:
Returns the permissions.

isLink

public boolean isLink()
Returns:
Returns true if file is a symlink

getLinkCount

public int getLinkCount()
Returns:
Returns the number of links to the file

getLinkedname

public java.lang.String getLinkedname()
Deprecated. 

Returns:
Returns the linked name.

getLinkedName

public java.lang.String getLinkedName()
Returns:
Returns the linked name.

setGroup

public void setGroup(java.lang.String group)
Parameters:
group - The group to set.

setDir

public void setDir(boolean isDir)
Parameters:
isDir - The isDir to set.

setLink

public void setLink(boolean isLink)
Parameters:
isLink - The isLink to set.

setLinkedName

public void setLinkedName(java.lang.String linkedname)
Parameters:
linkedname - The linked name to set.

setOwner

public void setOwner(java.lang.String owner)
Parameters:
owner - The owner to set.

setPermissions

public void setPermissions(java.lang.String permissions)
Parameters:
permissions - The permissions to set.

setLinkCount

public void setLinkCount(int linkCount)
Parameters:
linkCount - new link count

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
string representation

getPath

public java.lang.String getPath()

setPath

public void setPath(java.lang.String path)


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.