org.neociclo.odetteftp.protocol
Class CommandExchangeBuffer

java.lang.Object
  extended by org.neociclo.odetteftp.protocol.CommandExchangeBuffer
All Implemented Interfaces:
OdetteFtpExchangeBuffer

public class CommandExchangeBuffer
extends Object
implements OdetteFtpExchangeBuffer

A Command Exchange Buffer contains a single command starting at the beginning of the buffer. Commands and data are never mixed within an Exchange Buffer. Each command has a fixed length and can not be compressed.

In protocol version 2.0 implementation the CommandExchangeBuffer use DynamicField feature to compute the field size and/or positioning.

Version:
$Rev: 769 $ $Date: 2010-10-08 10:50:48 -0300 (Fri, 08 Oct 2010) $
Author:
Rafael Marins

Field Summary
static Charset DEFAULT_PROTOCOL_CHARSET
          Default charset defined in Odette FTP protocol specification.
static Charset UTF8_ENCODED_PROTOCOL_CHARSET
          UTF-8 charset encoding used in text description in the new OFTP 2.0.
 
Constructor Summary
CommandExchangeBuffer(CommandFormat commandFormat)
           
 
Method Summary
static boolean checkAttribute(char type, String value)
           
 boolean equals(Object obj)
           
static String formatAttribute(CommandFormat.Field field, String value)
           
 Object getAttribute(String name)
          Return a Command Exchange Buffer parameter value for the specified field.
 byte[] getByteArrayAttribute(String name)
           
 String[] getFieldNames()
           
 String getFormattedAttribute(String name)
           
 CommandIdentifier getIdentifier()
          Return the corresponding CommandIdentifier relative to the Exchange Buffer contents.
 ByteBuffer getRawBuffer()
           
 int getSize()
           
 String getStringAttribute(String name)
           
 Object setAttribute(String fieldName, Object value)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PROTOCOL_CHARSET

public static final Charset DEFAULT_PROTOCOL_CHARSET
Default charset defined in Odette FTP protocol specification.


UTF8_ENCODED_PROTOCOL_CHARSET

public static final Charset UTF8_ENCODED_PROTOCOL_CHARSET
UTF-8 charset encoding used in text description in the new OFTP 2.0.

Constructor Detail

CommandExchangeBuffer

public CommandExchangeBuffer(CommandFormat commandFormat)
Method Detail

formatAttribute

public static String formatAttribute(CommandFormat.Field field,
                                     String value)

checkAttribute

public static boolean checkAttribute(char type,
                                     String value)

getAttribute

public Object getAttribute(String name)
Return a Command Exchange Buffer parameter value for the specified field.

Parameters:
name - Field key name.
Returns:
Corresponding parameter value for a given field.

getStringAttribute

public String getStringAttribute(String name)

getByteArrayAttribute

public byte[] getByteArrayAttribute(String name)

getFormattedAttribute

public String getFormattedAttribute(String name)

getRawBuffer

public ByteBuffer getRawBuffer()
Specified by:
getRawBuffer in interface OdetteFtpExchangeBuffer

getFieldNames

public String[] getFieldNames()
Returns:
Array of strings representing attributes names.

getIdentifier

public CommandIdentifier getIdentifier()
Description copied from interface: OdetteFtpExchangeBuffer
Return the corresponding CommandIdentifier relative to the Exchange Buffer contents. Its value is parsed from the first octet of the Exchange Buffer specified through class constructor.

The CommandIdentifier defines the format of the Exchange Buffer contents.

Specified by:
getIdentifier in interface OdetteFtpExchangeBuffer
Returns:
CommandIdentifier Instance relative to the command type of this Exchange Buffer.
See Also:
org.neociclo.odetteftp.service.CommandIdentifier

getSize

public int getSize()
Specified by:
getSize in interface OdetteFtpExchangeBuffer

setAttribute

public Object setAttribute(String fieldName,
                           Object value)

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object


ACCORD