public class StringSetCodec extends Object implements StringCodec, Encodable
StringCodec
that encodes each given string to a shorter, but unique
alternate. Note that once the codec is instantiated it is immutable.
For a codec that allows you to add mappings after construction, use
EntropicStringSetCodec
instead.CodecFactory
Modifier and Type | Method and Description |
---|---|
String |
decode(String enc)
Decodes an encoded value.
|
String |
encode(String str)
Encodes an original string.
|
boolean |
equals(Object o) |
int |
hashCode() |
int |
size()
Returns the number of mappings in the codec.
|
String |
toDebugString()
Provides a multi-line string representation of the codec useful for
debugging purposes.
|
String |
toEncodedString()
Returns an encodement of this implementation.
|
String |
toString() |
static StringSetCodec |
valueOf(String blueprint)
Recreates an instance of StringSetCodec from the supplied blueprint.
|
public String encode(String str)
encode
in interface StringCodec
str
- the original stringNullPointerException
- if the parameter is nullIllegalArgumentException
- if the original string is not a
member of the initializing setpublic String decode(String enc)
decode
in interface StringCodec
enc
- the encoded valueNullPointerException
- if the parameter is nullIllegalArgumentException
- if the encoded value is not a member of
the encodings for the initializing setpublic int size()
StringCodec
size
in interface StringCodec
public String toEncodedString()
toEncodedString
in interface Encodable
public String toDebugString()
public static StringSetCodec valueOf(String blueprint)
toEncodedString()
.blueprint
- the blueprintNullPointerException
- if blueprint is nullIllegalArgumentException
- if blueprint if badly formedCopyright © 2015. All Rights Reserved.