public class TrimInfixAndSuffixEncoder extends Object implements ISequenceEncoder
dst
relative to src
by trimming whatever
non-equal suffix and infix src
and dst
have. The
output code is (bytes):
{X}{L}{K}{suffix}where
src's
infix at position (X
- 'A') and of
length (L
- 'A') should be removed, then (K
-
'A') bytes should be trimmed from the end and then the suffix
should be appended to the resulting byte sequence.
Examples:
src: ayz dst: abc encoded: AACbc src: aillent dst: aller encoded: BBCr
Constructor and Description |
---|
TrimInfixAndSuffixEncoder() |
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.