public class SimpleIntEncoder extends IntEncoder
IntEncoder
, writing an integer as 4 raw bytes. *out
Constructor and Description |
---|
SimpleIntEncoder() |
Modifier and Type | Method and Description |
---|---|
IntDecoder |
createMatchingDecoder()
Returns an
IntDecoder which matches this encoder. |
void |
encode(int value)
This method makes sure the value wasn't previously encoded by checking
against the Set.
|
String |
toString() |
close, reInit
public void encode(int value) throws IOException
encode
in class IntEncoder
value
- an integer to be encodedIOException
- possibly thrown by the OutputStreampublic IntDecoder createMatchingDecoder()
IntEncoder
IntDecoder
which matches this encoder. Every encoder
must return an IntDecoder
and null
is not a valid
value. If an encoder is just a filter, it should at least return its
wrapped encoder's matching decoder.
NOTE: this method should create a new instance of the matching decoder and leave the instance sharing to the caller. Returning the same instance over and over is risky because encoders and decoders are not thread safe.
createMatchingDecoder
in class IntEncoder