FTP Client

com.amoebacode.ftp
Class FTPUtil

java.lang.Object
  extended bycom.amoebacode.ftp.FTPUtil

abstract class FTPUtil
extends java.lang.Object

FTPUtil provides static utility methods for the FTPClient and FTPSocket.


Field Summary
private static java.lang.String CURRENT_RELATIVE_DIRECTORY
          The current relative directory filename
private static java.lang.String IP_SEPARATOR
          A period (the IP address value delimiter)
private static java.lang.String QUOTE
          A quotation mark
private static java.lang.String UP_RELATIVE_DIRECTORY
          The up relative directory filename
 
Constructor Summary
(package private) FTPUtil()
           
 
Method Summary
protected static java.lang.String getIPAddress(java.lang.String[] parts)
          Constructs an IP address from the specified String array of numbers.
protected static int getPort(java.lang.String[] parts)
          Determines the port from the specified String array of numbers.
protected static java.lang.String[] getStringArray(java.util.StringTokenizer st)
          Returns a String array comprised of the elements of the specified StringTokenizer.
protected static boolean isFTPResponse(java.lang.String response)
          Indicates whether the specified line is a proper FTP server response.
protected static boolean isRelativePath(java.lang.String fileName)
          Indicates whether the specified file name is a relative path filename.
protected static java.lang.String removeSurroundingQuotes(java.lang.String text)
          Returns surrounding quotation marks (when present) from the specified text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUOTE

private static final java.lang.String QUOTE
A quotation mark

See Also:
Constant Field Values

UP_RELATIVE_DIRECTORY

private static final java.lang.String UP_RELATIVE_DIRECTORY
The up relative directory filename

See Also:
Constant Field Values

CURRENT_RELATIVE_DIRECTORY

private static final java.lang.String CURRENT_RELATIVE_DIRECTORY
The current relative directory filename

See Also:
Constant Field Values

IP_SEPARATOR

private static final java.lang.String IP_SEPARATOR
A period (the IP address value delimiter)

See Also:
Constant Field Values
Constructor Detail

FTPUtil

FTPUtil()
Method Detail

isRelativePath

protected static boolean isRelativePath(java.lang.String fileName)
Indicates whether the specified file name is a relative path filename.

Parameters:
fileName - the file name to compare
Returns:
true if the file name is ".." or "."

removeSurroundingQuotes

protected static java.lang.String removeSurroundingQuotes(java.lang.String text)
Returns surrounding quotation marks (when present) from the specified text.

Parameters:
text - the String with surrounding quotation marks
Returns:
that String without surrounding quotation marks

getStringArray

protected static java.lang.String[] getStringArray(java.util.StringTokenizer st)
Returns a String array comprised of the elements of the specified StringTokenizer.

Parameters:
st - the StringTokenizer containing the results of the data command
Returns:
a String array containing the StringTokenizer elements

getIPAddress

protected static java.lang.String getIPAddress(java.lang.String[] parts)
Constructs an IP address from the specified String array of numbers.

Returns:
an IP address

getPort

protected static int getPort(java.lang.String[] parts)
Determines the port from the specified String array of numbers.

Returns:
the server port

isFTPResponse

protected static boolean isFTPResponse(java.lang.String response)
Indicates whether the specified line is a proper FTP server response.

Parameters:
response - a line received from the FTP server
Returns:
true if the line begins with three digits and a space

FTP Client