org.red5.server.net.protocol

## Class ProtocolState

- java.lang.Object
- - org.red5.server.net.protocol.ProtocolState

Direct Known Subclasses:
  RTMP

    public class ProtocolState
    extends Object

Represents current state of protocol.

### Field Summary

Fields
`static byte` `DECODER_BUFFER` Decoder is buffering state constant.
`static byte` `DECODER_CONTINUE` Deconding continues state constant.
`static byte` `DECODER_OK` Decoding finished successfully state constant.
`static String` `SESSION_KEY` Session key constant.

### Constructor Summary

Constructors
Constructor and Description
`ProtocolState()`

### Method Summary

Methods
`void` `bufferDecoding(int amount)` Specifies buffer decoding amount
`boolean` `canContinueDecoding()` Checks whether decoding process can be continued.
`boolean` `canStartDecoding(int remaining)` Checks whether remaining buffer size is greater or equal than buffer amount and so if it makes sense to start decoding.
`void` `continueDecoding()` Set decoding state as "needed to be continued".
`int` `getDecoderBufferAmount()` Returns current buffer amount.
`boolean` `hasDecodedObject()` Checks whether decoding is complete.
`void` `startDecoding()` Starts decoding.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### SESSION_KEY

    public static final String SESSION_KEY

Session key constant.

See Also:
  Constant Field Values

#### DECODER_OK

    public static byte DECODER_OK

Decoding finished successfully state constant.

#### DECODER_CONTINUE

    public static byte DECODER_CONTINUE

Deconding continues state constant.

#### DECODER_BUFFER

    public static byte DECODER_BUFFER

Decoder is buffering state constant.

### Constructor Detail

#### ProtocolState

    public ProtocolState()

### Method Detail

#### getDecoderBufferAmount

    public int getDecoderBufferAmount()

Returns current buffer amount.

Returns:
  Buffer amount

#### bufferDecoding

    public void bufferDecoding(int amount)

Specifies buffer decoding amount

Parameters:
  `amount` - Buffer decoding amount

#### continueDecoding

    public void continueDecoding()

Set decoding state as "needed to be continued".

#### canStartDecoding

    public boolean canStartDecoding(int remaining)

Checks whether remaining buffer size is greater or equal than buffer amount and so if it makes sense to start decoding.

Parameters:
  `remaining` - Remaining buffer size
Returns:
  `true` if there is data to decode, `false` otherwise

#### startDecoding

    public void startDecoding()

Starts decoding. Sets state to "ready" and clears buffer amount.

#### hasDecodedObject

    public boolean hasDecodedObject()

Checks whether decoding is complete.

Returns:
  `true` if decoding has finished, `false` otherwise

#### canContinueDecoding

    public boolean canContinueDecoding()

Checks whether decoding process can be continued.

Returns:
  `true` if decoding can be continued, `false` otherwise