|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--step.encoding.Encoder | +--step.encoding.CreepIntEncoder
Encoder for STEP int
types that uses a variable size encoding.
Values are encoded one byte at a time, using 7 bits for data and marking the high bit if more bytes should be read. The encoding is thus pseudo-LITTLE endian (least significant -> most significant), using 7 bit bytes.
The maximum number of bytes used by this encoding is 10, in signed mode: 9 (=63/7) for the 63 low bits plus one more to sign extend.
StepInt
,
IntEncoder
Constructor Summary | |
CreepIntEncoder(String name,
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. |
Methods inherited from class step.encoding.Encoder |
eventMessage, getFactory, getName, indent, makeFieldName |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CreepIntEncoder(String name, boolean unsigned, EncoderFactory factory)
int
types.
name
- the name for this encoder.unsigned
- true
if encoded/decoded values are always >= 0factory
- the EncoderFactory
used to create this encoderMethod Detail |
public void encode(StepObject o, EncodeContext context) throws EncoderException, IOException
int
value.
encode
in class Encoder
EncoderException
- 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 Encoder
IOException
- if the decode operation encountered an I/O failure.
EncoderException
- if the decode operation encountered an error.public void dump(int level)
dump
in class Encoder
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |