io.craft.atom.protocol.textline
Class TextLineDecoder

java.lang.Object
  extended by io.craft.atom.protocol.AbstractProtocolCodec
      extended by io.craft.atom.protocol.AbstractProtocolDecoder
          extended by io.craft.atom.protocol.textline.TextLineDecoder
All Implemented Interfaces:
ProtocolDecoder<String>

public class TextLineDecoder
extends AbstractProtocolDecoder
implements ProtocolDecoder<String>

A ProtocolDecoder which decodes bytes into text line string, default charset is utf-8
Not thread safe

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

Field Summary
 
Fields inherited from class io.craft.atom.protocol.AbstractProtocolDecoder
buf, defaultBufferSize, END, maxSize, searchIndex, splitIndex, START, state, stateIndex
 
Fields inherited from class io.craft.atom.protocol.AbstractProtocolCodec
charset
 
Constructor Summary
TextLineDecoder()
           
TextLineDecoder(Charset charset)
           
TextLineDecoder(Charset charset, String delimiter)
           
TextLineDecoder(Charset charset, String delimiter, int defaultBufferSize)
           
TextLineDecoder(Charset charset, String delimiter, int defaultBufferSize, int maxSize)
           
 
Method Summary
 List<String> decode(byte[] bytes)
           
 void setDelimiter(String delimiter)
           
 
Methods inherited from class io.craft.atom.protocol.AbstractProtocolDecoder
adapt, getBuf, getDefaultBufferSize, getMaxSize, getSearchIndex, getSplitIndex, getState, getStateIndex, reset, setBuf, setDefaultBufferSize, setMaxSize, setSearchIndex, setSplitIndex, setStateIndex, toString
 
Methods inherited from class io.craft.atom.protocol.AbstractProtocolCodec
getCharset, setCharset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface io.craft.atom.protocol.ProtocolDecoder
reset
 

Constructor Detail

TextLineDecoder

public TextLineDecoder()

TextLineDecoder

public TextLineDecoder(Charset charset)

TextLineDecoder

public TextLineDecoder(Charset charset,
                       String delimiter)

TextLineDecoder

public TextLineDecoder(Charset charset,
                       String delimiter,
                       int defaultBufferSize)

TextLineDecoder

public TextLineDecoder(Charset charset,
                       String delimiter,
                       int defaultBufferSize,
                       int maxSize)
Method Detail

decode

public List<String> decode(byte[] bytes)
                    throws ProtocolException
Specified by:
decode in interface ProtocolDecoder<String>
Throws:
ProtocolException

setDelimiter

public void setDelimiter(String delimiter)


Copyright © 2014. All Rights Reserved.