Package net.sf.basedb.util.encode
Class TabCrLfEncoderDecoder
java.lang.Object
net.sf.basedb.util.encode.TabCrLfEncoderDecoder
- All Implemented Interfaces:
EncoderDecoder
Symmetrical encoder/decoder implementation that replaces newline, carriage return,
tab and backslash with \n, \r, \t and \\. This encoder is suitable for use with
tab-separated text files.
- Since:
- 2.15
- Author:
- Nicklas
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTabCrLfEncoderDecoder
(boolean nullIsEmptyString) Creates a new encoder/decoder. -
Method Summary
-
Field Details
-
nullIsEmptyString
private final boolean nullIsEmptyString
-
-
Constructor Details
-
TabCrLfEncoderDecoder
public TabCrLfEncoderDecoder(boolean nullIsEmptyString) Creates a new encoder/decoder.- Parameters:
nullIsEmptyString
- TRUE to encode null as empty string, FALSE to not encode null. NOTE! If TRUE, this encoder is no longer symmetrical
-
-
Method Details
-
isSymmetrical
public boolean isSymmetrical()- Specified by:
isSymmetrical
in interfaceEncoderDecoder
- Returns:
- TRUE if the encoder is symmetrical, FALSE if not
-
decode
- Specified by:
decode
in interfaceEncoderDecoder
- Parameters:
s
- The string to decode- Returns:
- The decoded string
-
encode
- Specified by:
encode
in interfaceEncoderDecoder
- Parameters:
s
- The string to encode- Returns:
- The encoded string
-