org.littleshoot.util.mina
Class ConsumeToTerminatorDecodingState

java.lang.Object
  extended by org.littleshoot.util.mina.ConsumeToTerminatorDecodingState
All Implemented Interfaces:
DecodingState
Direct Known Subclasses:
ConsumeToLinearWhitespaceDecodingState

public abstract class ConsumeToTerminatorDecodingState
extends Object
implements DecodingState

Consumes until a fixed (ASCII) character is reached. This also allows several characters to act as terminators. In this case, the first terminator that is read ends the reading, i.e. it doesn't look for multiple terminators strung together. The terminator is skipped.


Constructor Summary
protected ConsumeToTerminatorDecodingState(byte terminator)
          Creates a new instance.
protected ConsumeToTerminatorDecodingState(byte terminator1, byte terminator2)
          Creates a new instance.
 
Method Summary
 DecodingState decode(org.littleshoot.mina.common.ByteBuffer in, org.littleshoot.mina.filter.codec.ProtocolDecoderOutput out)
          Decodes the input for this state.
protected abstract  DecodingState finishDecode(byte foundTerminator, org.littleshoot.mina.common.ByteBuffer product, org.littleshoot.mina.filter.codec.ProtocolDecoderOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumeToTerminatorDecodingState

protected ConsumeToTerminatorDecodingState(byte terminator)
Creates a new instance.

Parameters:
terminator - The terminator.

ConsumeToTerminatorDecodingState

protected ConsumeToTerminatorDecodingState(byte terminator1,
                                           byte terminator2)
Creates a new instance.

Parameters:
terminator1The - first terminator.
terminator2 - The second terminator.
Method Detail

decode

public DecodingState decode(org.littleshoot.mina.common.ByteBuffer in,
                            org.littleshoot.mina.filter.codec.ProtocolDecoderOutput out)
                     throws Exception
Description copied from interface: DecodingState
Decodes the input for this state.

Specified by:
decode in interface DecodingState
Parameters:
in - The read data.
out - The output to write to.
Returns:
The next decoding state.
Throws:
Exception - If any error occurs.

finishDecode

protected abstract DecodingState finishDecode(byte foundTerminator,
                                              org.littleshoot.mina.common.ByteBuffer product,
                                              org.littleshoot.mina.filter.codec.ProtocolDecoderOutput out)
                                       throws Exception
Throws:
Exception


Copyright © 2013 LittleShoot. All Rights Reserved.