com.myjavaworld.ftp
Class FTPUtil

java.lang.Object
  extended by com.myjavaworld.ftp.FTPUtil

public class FTPUtil
extends java.lang.Object

An utility class

Version:
2.0
Author:
Sai Pullabhotla, psai [at] jMethods [dot] com

Field Summary
static java.lang.String[] MODES
          Codes for modes.
static java.lang.String[] STRUCTURES
          Codes for structures.
static java.lang.String[] TYPE_NAMES
          Names for data representation types.
static java.lang.String[] TYPES
          Codes for data representation types.
 
Constructor Summary
FTPUtil()
           
 
Method Summary
static java.lang.String getMode(int mode)
          Returns the mode code.
static java.lang.String getPortCommand(java.lang.String ip, int port)
           
static java.lang.String getPortCommandOld(java.lang.String ip, int port)
           
static java.lang.String getStructure(int structure)
          Returns the structure code.
static java.lang.String getType(int type)
          Returns the type code for a given type.
static java.lang.String parseAddress(java.lang.String reply)
          Extracts the host address from the reply of a PASV command.
static java.lang.String parseAttributes(java.lang.String attributes)
           
static java.lang.String parsePath(java.lang.String reply)
          Extracts the path from the given string.
static int parsePort(java.lang.String reply)
           
static int parsePortOld(java.lang.String reply)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPES

public static final java.lang.String[] TYPES
Codes for data representation types.


TYPE_NAMES

public static final java.lang.String[] TYPE_NAMES
Names for data representation types.


STRUCTURES

public static final java.lang.String[] STRUCTURES
Codes for structures.


MODES

public static final java.lang.String[] MODES
Codes for modes.

Constructor Detail

FTPUtil

public FTPUtil()
Method Detail

getType

public static java.lang.String getType(int type)
Returns the type code for a given type.

Parameters:
type - type constant as defined in FTPConstants.
Returns:
type code as defined in FTP spec.

getStructure

public static java.lang.String getStructure(int structure)
Returns the structure code.

Parameters:
structure - structure constant as defined in FTPConstants.
Returns:
structure code as defined in FTP spec.

getMode

public static java.lang.String getMode(int mode)
Returns the mode code.

Parameters:
mode - mode constant as defined in FTPConstants.
Returns:
mode code as defined in FTP spec.

parsePath

public static java.lang.String parsePath(java.lang.String reply)
Extracts the path from the given string.

Parameters:
reply -
Returns:
Path

parseAddress

public static java.lang.String parseAddress(java.lang.String reply)
Extracts the host address from the reply of a PASV command.

Parameters:
reply - Reply of the PASV command
Returns:
Address

parsePort

public static int parsePort(java.lang.String reply)
Parameters:
reply -
Returns:

parsePortOld

public static int parsePortOld(java.lang.String reply)
Parameters:
reply -
Returns:

getPortCommand

public static java.lang.String getPortCommand(java.lang.String ip,
                                              int port)
Parameters:
ip -
port -
Returns:

getPortCommandOld

public static java.lang.String getPortCommandOld(java.lang.String ip,
                                                 int port)
Parameters:
ip -
port -
Returns:

parseAttributes

public static java.lang.String parseAttributes(java.lang.String attributes)
Parameters:
attributes -
Returns: