ftp
Class FtpListResult

java.lang.Object
  |
  +--ftp.FtpListResult

public class FtpListResult
extends java.lang.Object

This class is used to parse the information of a returned String from the 'LIST' command.
It parse the following information from the list:
1) Name
2) Permission
3) Type
4) Owner
5) Group
6) Size

Sample code for using this class:
while(ftplist.next())
{
System.out.println(ftplist.getName());
}


Normally, we can see two formats returned by the ftp LIST command.
One is the standard UNIX format, and another one is the MS-DOS format (rarely see).
This class can parse both formats. Unfortunely, the following information are missed in
the MS-DOS format:
1) Owner of file
note: getOwner() method returns "" all the time.
2) Group whihc own the file
note: getGroup() method returns "" all the time.
3) File permission
note: getPermission() method returns "" all the time.
Those methods like getOwnerReadable() returns true all the time.


Field Summary
static int DIRECTORY
           
static int FILE
           
static int LINK
           
static int OTHERS
           
 
Constructor Summary
FtpListResult()
           
 
Method Summary
 java.lang.String getGroup()
          Get the name of the group which own the file, directory or link.
 java.lang.String getName()
          Get name.
 java.lang.String getOwner()
          Get the user which own the file, directory or link.
 java.lang.String getPermission()
          Get permission.
 long getSize()
          Get size.
 int getType()
          Get the type.
 boolean globalExecutable()
          Whether it is global executable.
 boolean globalReadable()
          Whether it is global readable.
 boolean globalWritable()
          Whether it is global writable.
 boolean groupExecutable()
          Whether it is executable by group.
 boolean groupReadable()
          Whether it is readable by group.
 boolean groupWritable()
          Whether it is writable by group.
 boolean next()
          A FtpListResult is initially positioned before its first row.
 boolean ownerExecutable()
          Whether it is executable by owner.
 boolean ownerReadable()
          Whether it is readable by owner.
 boolean ownerWritable()
          Whether it is writable by owner.
protected  void parseList(java.lang.String strlist, java.lang.String system_type)
          Parse the information from the string list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIRECTORY

public static final int DIRECTORY

FILE

public static final int FILE

LINK

public static final int LINK

OTHERS

public static final int OTHERS
Constructor Detail

FtpListResult

public FtpListResult()
Method Detail

getGroup

public java.lang.String getGroup()
Get the name of the group which own the file, directory or link.

getName

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

getOwner

public java.lang.String getOwner()
Get the user which own the file, directory or link.

getPermission

public java.lang.String getPermission()
Get permission.

getSize

public long getSize()
Get size.

getType

public int getType()
Get the type.
Returns:
the int DIRECTORY,FILE or LINK.

ownerReadable

public boolean ownerReadable()
Whether it is readable by owner.
Returns:
True if readable by owner.

ownerWritable

public boolean ownerWritable()
Whether it is writable by owner.
Returns:
True if writable by owner.

ownerExecutable

public boolean ownerExecutable()
Whether it is executable by owner.
Returns:
True if executable by owner.

groupReadable

public boolean groupReadable()
Whether it is readable by group.
Returns:
True if readable by group.

groupWritable

public boolean groupWritable()
Whether it is writable by group.
Returns:
True if writable by group.

groupExecutable

public boolean groupExecutable()
Whether it is executable by group.
Returns:
True if executable by group.

globalReadable

public boolean globalReadable()
Whether it is global readable.
Returns:
True if global readable.

globalWritable

public boolean globalWritable()
Whether it is global writable.
Returns:
True if global writable.

globalExecutable

public boolean globalExecutable()
Whether it is global executable.
Returns:
True if global executable.

next

public boolean next()
A FtpListResult is initially positioned before its first row. the first call to next makes the first row the current row; the second call makes the second row the current row, etc
Returns:
true if the new current row is valid; false if there are no more rows.

parseList

protected void parseList(java.lang.String strlist,
                         java.lang.String system_type)
Parse the information from the string list