public class TrimSuffixEncoder extends Object implements ISequenceEncoder
dst
relative to src
by trimming whatever
non-equal suffix src
has. The output code is (bytes):
{K}{suffix}where (
K
- 'A') bytes should be trimmed from the end of
src
and then the suffix
should be appended to the
resulting byte sequence.
Examples:
src: foo dst: foobar encoded: Abar src: foo dst: bar encoded: Dbar
Constructor and Description |
---|
TrimSuffixEncoder() |
Modifier and Type | Method and Description |
---|---|
ByteBuffer |
decode(ByteBuffer reuse,
ByteBuffer source,
ByteBuffer encoded)
|
ByteBuffer |
encode(ByteBuffer reuse,
ByteBuffer source,
ByteBuffer target)
|
String |
toString() |
public ByteBuffer encode(ByteBuffer reuse, ByteBuffer source, ByteBuffer target)
ISequenceEncoder
encode
in interface ISequenceEncoder
reuse
- Reuses the provided ByteBuffer
or allocates a new one if there is not enough remaining space.source
- The source byte sequence.target
- The target byte sequence to encode relative to source
ByteBuffer
with encoded target
.public ByteBuffer decode(ByteBuffer reuse, ByteBuffer source, ByteBuffer encoded)
ISequenceEncoder
decode
in interface ISequenceEncoder
reuse
- Reuses the provided ByteBuffer
or allocates a new one if there is not enough remaining space.source
- The source byte sequence.encoded
- The previously encoded byte sequence.ByteBuffer
with decoded target
.Copyright © 2016. All rights reserved.