org.craft.atom.protocol.textline
Class TextLineEncoder

java.lang.Object
  extended by org.craft.atom.protocol.AbstractProtocolCodec
      extended by org.craft.atom.protocol.AbstractProtocolEncoder
          extended by org.craft.atom.protocol.textline.TextLineEncoder
All Implemented Interfaces:
ProtocolEncoder<String>

public class TextLineEncoder
extends AbstractProtocolEncoder
implements ProtocolEncoder<String>

A ProtocolEncoder which encodes a text line string into bytes which ends with the delimiter, default charset is utf-8.
Thread safe.

Version:
1.0, Oct 16, 2012
Author:
Hu Feng

Field Summary
 
Fields inherited from class org.craft.atom.protocol.AbstractProtocolCodec
charset
 
Constructor Summary
TextLineEncoder()
           
TextLineEncoder(Charset charset)
           
TextLineEncoder(Charset charset, String delimiter)
           
TextLineEncoder(Charset charset, String delimiter, int maxLineLength)
           
 
Method Summary
 byte[] encode(String str)
           
 
Methods inherited from class org.craft.atom.protocol.AbstractProtocolEncoder
toString
 
Methods inherited from class org.craft.atom.protocol.AbstractProtocolCodec
getCharset, setCharset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextLineEncoder

public TextLineEncoder()

TextLineEncoder

public TextLineEncoder(Charset charset)

TextLineEncoder

public TextLineEncoder(Charset charset,
                       String delimiter)

TextLineEncoder

public TextLineEncoder(Charset charset,
                       String delimiter,
                       int maxLineLength)
Method Detail

encode

public byte[] encode(String str)
              throws ProtocolException
Specified by:
encode in interface ProtocolEncoder<String>
Throws:
ProtocolException


Copyright © 2013. All Rights Reserved.