2.17.2: 2011-06-17

net.sf.basedb.util.encode
Interface EncoderDecoder

All Known Implementing Classes:
IdentityEncoderDecoder, TabCrLfEncoderDecoder, ToSpaceEncoderDecoder

public interface EncoderDecoder

Interface for encoding and decoding strings to make them work in a certain context. For example, in tab-separated text files tabs, newlines, etc. need to be encoded or the number of columns or lines will be incorrect.

An encoder is usually paired with a decoder. It is not a requirement that the encoding is symmetrical. If the encoding is symmetrical the result of encoding and then decoding must be equal the original string and so must the result of decoding and then encoding.

It is up to the implementation how null values are handled. Some implementations may not support null and may throw an exception. Note that null value handling must also be symmetrical if isSymmetrical() returns true.

Since:
2.15
Author:
Nicklas

Method Summary
 String decode(String s)
           
 String encode(String s)
           
 boolean isSymmetrical()
           
 

Method Detail

isSymmetrical

boolean isSymmetrical()
Returns:
TRUE if the encoder is symmetrical, FALSE if not

encode

String encode(String s)
Parameters:
s - The string to encode
Returns:
The encoded string

decode

String decode(String s)
Parameters:
s - The string to decode
Returns:
The decoded string

2.17.2: 2011-06-17