org.neociclo.odetteftp.protocol
Class DataExchangeBuffer.SubrecordHeader

java.lang.Object
  extended by org.neociclo.odetteftp.protocol.DataExchangeBuffer.SubrecordHeader
Enclosing class:
DataExchangeBuffer

public static class DataExchangeBuffer.SubrecordHeader
extends Object

Subrecord Header is defined in one octet as follows:

           0   1   2   3   4   5   6   7
         o-------------------------------o
         | E | C |                       |
         | o | F | C O U N T             |
         | R |   |                       |
         o-------------------------------o


   Bits
 
    0     End of Record Flag
 
          Set to indicate that the next subrecord is the last
          subrecord of the current record.
 
          Unstructured files are transmitted as a single record; in
          this case, the flag acts as an end-of-file marker.
 
    1     Compression Flag
 
          Set to indicate that the next subrecord is compressed.
 
   2-7    Subrecord Count
 
          The number of octets in the Virtual File represented by the
          next subrecord expressed as a binary value.
 
          For uncompressed data, this is simply the length of the
          subrecord.
 
          For compressed data, this is the number of times that the
          single octet in the following subrecord must be inserted in
          the Virtual File.
 
          As 6 bits are available, the next subrecord may represent
          between 0 and 63 octets of the Virtual File.
 


Constructor Summary
DataExchangeBuffer.SubrecordHeader(int startPos, boolean eor, boolean compr, byte count)
           
 
Method Summary
 byte asOctet()
           
 byte getCount()
          The number of octets in the Virtual File represented by the next subrecord expressed as a binary value.
 int getDataIndex()
           
static byte getSubrecordCount(short headerOctet)
          Subrecord Count: last 6 bits
 boolean isCompressed()
          Set to indicate that the next subrecord is compressed.
static boolean isCompressed(short headerOctet)
          Compression Flag: is second bit set?
 boolean isEndOfRecord()
          Set to indicate that the next subrecord is the last subrecord of the current record.
static boolean isEndOfRecord(short headerOctet)
          End of Record: is first bit set?
static byte toOctet(boolean endOfRecord, boolean compression, byte count)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DataExchangeBuffer.SubrecordHeader

public DataExchangeBuffer.SubrecordHeader(int startPos,
                                          boolean eor,
                                          boolean compr,
                                          byte count)
Parameters:
startPos - the Subrecord position within the Data Exchange Buffer (after the Subrecord header).
eor - End of Record flag.
compr - Compression flag.
count - Subrecord count.
Method Detail

getSubrecordCount

public static byte getSubrecordCount(short headerOctet)
Subrecord Count: last 6 bits

Parameters:
headerOctet -
Returns:

isCompressed

public static boolean isCompressed(short headerOctet)
Compression Flag: is second bit set?

Parameters:
headerOctet -
Returns:

isEndOfRecord

public static boolean isEndOfRecord(short headerOctet)
End of Record: is first bit set?

Parameters:
headerOctet -
Returns:

toOctet

public static byte toOctet(boolean endOfRecord,
                           boolean compression,
                           byte count)

asOctet

public byte asOctet()

getCount

public byte getCount()
The number of octets in the Virtual File represented by the next subrecord expressed as a binary value.

For uncompressed data this is simply the length of the subrecord.

For compressed data this is the number of times that the single octet in the following subrecord must be inserted in the Virtual File.

As six bits are available, the next subrecord may represent between 0 and 63 octets of the Virtual File.

Returns:

getDataIndex

public int getDataIndex()

isCompressed

public boolean isCompressed()
Set to indicate that the next subrecord is compressed.

Returns:

isEndOfRecord

public boolean isEndOfRecord()
Set to indicate that the next subrecord is the last subrecord of the current record.

Unstructured files are transmitted as a single record, in this case the flag acts as an end of file marker.

Returns:

toString

public String toString()
Overrides:
toString in class Object


ACCORD