com.sun.grizzly.util
Interface StreamAlgorithm<E>

All Known Implementing Classes:
ContainerStaticStreamAlgorithm, ContentLengthAlgorithm, NoParsingAlgorithm, SeekHeaderAlgorithm, StateMachineAlgorithm, StaticStreamAlgorithm, StreamAlgorithmBase

Deprecated. Use the ProtocolParser instead.

public interface StreamAlgorithm<E>

Generic parsing interface that can be used to implement protocol specific logic parsing.

Author:
Jean-Francois Arcand

Method Summary
 ByteBuffer allocate(boolean useDirect, boolean useView, int size)
          Deprecated. Allocate a ByteBuffer
 int contentLength()
          Deprecated. Return the stream content-length.
 Interceptor getHandler()
          Deprecated. The Interceptor associated with this algorithm.
 int getPort()
          Deprecated. Return the port
 int headerLength()
          Deprecated. Return the stream header length.
 boolean parse(ByteBuffer byteBuffer)
          Deprecated. Parse the ByteBuffer and try to determine if the bytes stream has been fully read from the SocketChannel.
 ByteBuffer postParse(ByteBuffer byteBuffer)
          Deprecated. After parsing the bytes, post process the ByteBuffer
 ByteBuffer preParse(ByteBuffer byteBuffer)
          Deprecated. Before parsing the bytes, initialize and prepare the algorithm.
 void recycle()
          Deprecated. Recycle the algorithm.
 ByteBuffer rollbackParseState(ByteBuffer byteBuffer)
          Deprecated. Rollback the ByteBuffer to its previous state in case an error as occured.
 void setChannel(E channel)
          Deprecated. Set the Channel used by this algorithm
 void setPort(int port)
          Deprecated. Set the port this algorithm is used.
 

Method Detail

contentLength

int contentLength()
Deprecated. 
Return the stream content-length. If the content-length wasn't parsed, return -1.

Returns:
content length or -1 if content length was not parsed

headerLength

int headerLength()
Deprecated. 
Return the stream header length. The header length is the length between the start of the stream and the first occurance of character '\r\n' .

Returns:
header length

allocate

ByteBuffer allocate(boolean useDirect,
                    boolean useView,
                    int size)
Deprecated. 
Allocate a ByteBuffer

Parameters:
useDirect - allocate a direct ByteBuffer.
useView - allocate a view ByteBuffer.
size - the size of the newly created ByteBuffer.
Returns:
a new ByteBuffer

preParse

ByteBuffer preParse(ByteBuffer byteBuffer)
Deprecated. 
Before parsing the bytes, initialize and prepare the algorithm.

Parameters:
byteBuffer - the ByteBuffer used by this algorithm
Returns:
ByteBuffer used by this algorithm

parse

boolean parse(ByteBuffer byteBuffer)
Deprecated. 
Parse the ByteBuffer and try to determine if the bytes stream has been fully read from the SocketChannel.

Parameters:
byteBuffer - the bytes read.
Returns:
true if the algorithm determines the end of the stream.

postParse

ByteBuffer postParse(ByteBuffer byteBuffer)
Deprecated. 
After parsing the bytes, post process the ByteBuffer

Parameters:
byteBuffer - the ByteBuffer used by this algorithm
Returns:
ByteBuffer used by this algorithm

recycle

void recycle()
Deprecated. 
Recycle the algorithm.


rollbackParseState

ByteBuffer rollbackParseState(ByteBuffer byteBuffer)
Deprecated. 
Rollback the ByteBuffer to its previous state in case an error as occured.

Parameters:
byteBuffer -
Returns:
ByteBuffer

getHandler

Interceptor getHandler()
Deprecated. 
The Interceptor associated with this algorithm.

Returns:
Interceptor

setChannel

void setChannel(E channel)
Deprecated. 
Set the Channel used by this algorithm

Parameters:
channek - set Channel

setPort

void setPort(int port)
Deprecated. 
Set the port this algorithm is used.

Parameters:
port - port number

getPort

int getPort()
Deprecated. 
Return the port

Returns:
port number being used


Copyright © 2013 Oracle Corporation. All Rights Reserved.