Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD
 

com.newstep.solid.netio.slip.codec
Class SignedShortCodec
All Implemented Interfaces:
       SlipMessageHeaderCodec

public class SignedShortCodec      
Encodes and decodes SLIP message headers containing the payload length. On
encoding the codec converts the signed integer value into a signed short
first ensuring that the length value will fit in a signed short.
(ie. 0--> 2^15 - 1).


In order to decode SLIP messages, the codec simply needs to read the short
value into an integer.

Implements:
SlipMessageHeaderCodec
 
Links:
Implementation Implementation Link
to Interface SlipMessageHeaderCodec
Encodes and decodes SLIP message headers containing the payload length. On
encoding the codec converts the signed integer value into a signed short
first ensuring that the length value will fit in a signed short.
(ie. 0--> 2^15 - 1).


In order to decode SLIP messages, the codec simply needs to read the short
value into an integer.

 
 

Method Summary
public int
decode(ByteBuffer buffer)
public void
encode(ByteBuffer buffer, Integer length)
Method Detail
decode
public int decode (ByteBuffer buffer)
 
Decodes the length value from the specified buffer
Parameters:
buffer The ByteBuffer from which to decode the payload length
value
 

encode
public void encode (ByteBuffer buffer, Integer length)
 
Encodes the payload length into the specified buffer by converting the
signed integer value into a signed short. This function first ensures the
integer value will fit in a signed short (0--> 2^15-1)
Parameters:
buffer The ByteBuffer into which the length header should be
encoded
length The signed integer value representing the size of the SLIP
message's associated payload (in bytes). Must fit into a signed short
(0 --> 2^15-1)
 

Class
Tree
          
SUMMARY: INNER | FIELD | CONSTR | METHODDETAIL: FIELD | CONSTR | METHOD