rheise.jftpd
Class Representation

java.lang.Object
  |
  +--rheise.jftpd.Representation
Direct Known Subclasses:
AsciiRepresentation, ImageRepresentation

public abstract class Representation
extends java.lang.Object

A File is transferred to and from the FTP server using a particular representation. The server can be told which representation type to use with the TYPE command. Each subclass of Representation handles the conversion of data between that type and the server's storage representation.


Field Summary
static Representation ASCII
          The ASCII representation.
private  char code
          The character code for this representation.
static Representation IMAGE
          The IMAGE representation.
private  java.lang.String name
          The name of the representation.
private static java.util.Hashtable representations
          A code to representation map.
 
Constructor Summary
protected Representation(java.lang.String name, char code)
           
 
Method Summary
static Representation get(char code)
           
 char getCode()
           
abstract  java.io.InputStream getInputStream(java.net.Socket socket)
           
 java.lang.String getName()
           
abstract  java.io.OutputStream getOutputStream(java.net.Socket socket)
           
abstract  long sizeOf(java.io.File file)
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

representations

private static java.util.Hashtable representations
A code to representation map.

ASCII

public static final Representation ASCII
The ASCII representation.

IMAGE

public static final Representation IMAGE
The IMAGE representation.

name

private java.lang.String name
The name of the representation.

code

private char code
The character code for this representation.
Constructor Detail

Representation

protected Representation(java.lang.String name,
                         char code)
Method Detail

get

public static Representation get(char code)
Returns:
the Representation indicated by the code argument.

getName

public final java.lang.String getName()
Returns:
the name of this representation type.

getCode

public final char getCode()
Returns:
the character code for this representation type.

getInputStream

public abstract java.io.InputStream getInputStream(java.net.Socket socket)
                                            throws java.io.IOException
Returns:
an input stream to read data from the socket. Data will be translated from this representation to the server's representation.

getOutputStream

public abstract java.io.OutputStream getOutputStream(java.net.Socket socket)
                                              throws java.io.IOException
Returns:
an output stream to write data to the socket. Data will be translated from the server's representation to this representation.

sizeOf

public abstract long sizeOf(java.io.File file)
                     throws java.io.IOException
Returns:
the size that the specified file would have in this representation.