2.17.2: 2011-06-17

net.sf.basedb.util.encode
Class TabCrLfEncoderDecoder

java.lang.Object
  extended by net.sf.basedb.util.encode.TabCrLfEncoderDecoder
All Implemented Interfaces:
EncoderDecoder

public class TabCrLfEncoderDecoder
extends Object
implements 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
private  boolean nullIsEmptyString
           
 
Constructor Summary
TabCrLfEncoderDecoder(boolean nullIsEmptyString)
          Creates a new encoder/decoder.
 
Method Summary
 String decode(String s)
           
 String encode(String s)
           
 boolean isSymmetrical()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nullIsEmptyString

private final boolean nullIsEmptyString
Constructor Detail

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 Detail

isSymmetrical

public boolean isSymmetrical()
Specified by:
isSymmetrical in interface EncoderDecoder
Returns:
TRUE if the encoder is symmetrical, FALSE if not

decode

public String decode(String s)
Specified by:
decode in interface EncoderDecoder
Parameters:
s - The string to decode
Returns:
The decoded string

encode

public String encode(String s)
Specified by:
encode in interface EncoderDecoder
Parameters:
s - The string to encode
Returns:
The encoded string

2.17.2: 2011-06-17