step.encoding
Class OffsetIntStrategy
java.lang.Object
|
+--step.encoding.Encoder
|
+--step.encoding.Strategy
|
+--step.encoding.OffsetIntStrategy
- public class OffsetIntStrategy
- extends Strategy
Instead of transmitting the absolute (integer) value, transmit the offset
from a fixed base value.
NOTE: The same (base) encoder is used for the offset value. Thus, if the
base values have the "unsigned" property, so must the offset values.
Algorithm:
-> current - base
Credit: Chilimbi, Jones, Zorn (HATF/Meta-TF)
- See Also:
StepInt
,
WindowIntStrategy
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
STRATEGY_NAME
public static final String STRATEGY_NAME
- See Also:
- Constant Field Values
OffsetIntStrategy
public OffsetIntStrategy(Encoder baseEncoder)
- Create a new "offset" strategy.
The first value is used as the base value.
- Parameters:
baseEncoder
- the encoder to use for the inital value
OffsetIntStrategy
public OffsetIntStrategy(Encoder baseEncoder,
StepInt base)
- Create a new "offset" strategy.
- Parameters:
baseEncoder
- the base encoder, only used for identificationbase
- the base value to subtract from input values.
encode
public void encode(StepObject o,
EncodeContext context)
throws EncoderException,
IOException
- Encode an offset value.
- Specified by:
encode
in class Encoder
- Throws:
EncoderException
- if the value is not a StepInt
.
IOException
- if the encode operation encountered an I/O failure.
decode
public StepObject decode(DecodeContext context)
throws EncoderException,
IOException
- Decode an offset value.
- Specified by:
decode
in class Encoder
- Throws:
IOException
- if the decode operation encountered an I/O failure.
EncoderException
- if the decode operation encountered an error.
dump
public void dump(int level)
- Specified by:
dump
in class Encoder