|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object
|
+--step.encoding.Encoder
|
+--step.encoding.IntEncoder
An encoder for STEP int objects that uses a specific number of bytes.
Bytes are written in LITTLE endian (least significant -> most significant)
order. If the required number of bits is greater than the allowed size,
either an EncoderMessageEvent signals the deviant size value or an
exception is thrown if the size is fixed. If the number of bytes is too
small, the value is padded.
StepInt,
CreepIntEncoder| Field Summary | |
static int |
ELASTIC_SIZE
|
static int |
FIXED_SIZE
|
static int |
GROW_SIZE
|
(package private) static int |
LONG_SIZE
|
| Constructor Summary | |
IntEncoder(String name,
int size,
int resize,
boolean unsigned,
EncoderFactory factory)
Create a new encoder for STEP int types. |
|
| Method Summary | |
StepObject |
decode(DecodeContext context)
Decode a STEP int value. |
void |
dump(int level)
|
void |
encode(StepObject o,
EncodeContext context)
Encode the given STEP int value. |
protected void |
eventMessage(String msg)
Send a text message to this encoder. |
| Methods inherited from class step.encoding.Encoder |
getFactory, getName, indent, makeFieldName |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int FIXED_SIZE
public static final int ELASTIC_SIZE
public static final int GROW_SIZE
static final int LONG_SIZE
| Constructor Detail |
public IntEncoder(String name,
int size,
int resize,
boolean unsigned,
EncoderFactory factory)
int types.
name - the name for this encoder.size - the (minimum) number of bytes to use for encodingresize - the policy regarding size changes.
One of FIXED_SIZE, ELASTIC_SIZE or GROW_SIZE.unsigned - true if encoded/decoded values are always >= 0factory - the EncoderFactory used to create this encoder
IllegalArgumentException - if the size or resize values are invalid.| Method Detail |
public void encode(StepObject o,
EncodeContext context)
throws EncoderException,
IOException
int value.
encode in class EncoderEncoderException - if
StepInt.
IOException - if the encode operation encountered an I/O failure.
public StepObject decode(DecodeContext context)
throws EncoderException,
IOException
int value.
decode in class EncoderIOException - if the decode operation encountered an I/O failure.
EncoderException - if the decode operation encountered an error.protected void eventMessage(String msg)
EncoderIn general, messages are intended for the decoding process.
The default behavior is to ignore the message.
eventMessage in class EncoderEncoderMessageEventpublic void dump(int level)
dump in class Encoder
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||