com.myjavaworld.ftp
Class FTPUtil

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

public class FTPUtil
extends Object

An utility class

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

Field Summary
static String[] MODES
          Codes for modes.
static String[] STRUCTURES
          Codes for structures.
static String[] TYPE_NAMES
          Names for data representation types.
static String[] TYPES
          Codes for data representation types.
 
Constructor Summary
FTPUtil()
           
 
Method Summary
static void close(Closeable closeable)
           
static void close(ServerSocket serverSocket)
           
static void close(Socket socket)
           
static String getMode(int mode)
          Returns the mode code.
static String getPortCommand(String ip, int port)
           
static String getStructure(int structure)
          Returns the structure code.
static String getType(int type)
          Returns the type code for a given type.
static String parseAddress(String reply)
          Extracts the host address from the reply of a PASV command.
static String parseAttributes(String attributes)
           
static String parsePath(String reply)
          Extracts the path from the given string.
static int parsePort(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 String[] TYPES
Codes for data representation types.


TYPE_NAMES

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


STRUCTURES

public static final String[] STRUCTURES
Codes for structures.


MODES

public static final String[] MODES
Codes for modes.

Constructor Detail

FTPUtil

public FTPUtil()
Method Detail

getType

public static 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 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 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 String parsePath(String reply)
Extracts the path from the given string.

Parameters:
reply -
Returns:
Path

parseAddress

public static String parseAddress(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(String reply)
Parameters:
reply -
Returns:

getPortCommand

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

parseAttributes

public static String parseAttributes(String attributes)
Parameters:
attributes -
Returns:

close

public static void close(Closeable closeable)

close

public static void close(Socket socket)

close

public static void close(ServerSocket serverSocket)


Copyright © 2000-2012 jMethods, Inc.. All Rights Reserved.