Enum BufferState
- java.lang.Object
-
- java.lang.Enum<BufferState>
-
- org.eclipse.net4j.buffer.BufferState
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<BufferState>
public enum BufferState extends java.lang.Enum<BufferState>
Enumerates the internal states of anIBuffer.- Author:
- Eike Stepper
- No Extend
- This interface is not intended to be extended by clients.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description DISPOSEDIndicates that theIBuffercan not be used anymore.GETTINGIndicates that theIBuffercan provide aByteBufferthat can be used for getting data.INITIALIndicates that theIBufferhas just been provided by itsIBufferProvideror that is has been used and subsequentlycleared.PUTTINGIndicates that theIBuffercan provide aByteBufferthat can be used for putting data.READING_BODYIndicates that theIBufferis currently reading its body from aSocketChannel.READING_HEADERIndicates that theIBufferis currently reading its header from aSocketChannel.RELEASEDIndicates that theIBufferis owned by itsIBufferProvider.WRITINGIndicates that theIBufferis currently writing its data to aSocketChannel.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferStatevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static BufferState[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INITIAL
public static final BufferState INITIAL
Indicates that theIBufferhas just been provided by itsIBufferProvideror that is has been used and subsequentlycleared.A transition to
PUTTINGcan be triggered by callingIBuffer.startPutting(short)once. If the buffer is intended to be passed to anIChannellater thechannel indexof that Channel has to be passed because it is part of the buffer's header. AByteBufferis returned that can be used for putting data.A transition to
GETTINGcan be triggered by callingIBuffer.startGetting(SocketChannel)repeatedly until it finally returns aByteBufferthat can be used for getting data.
-
PUTTING
public static final BufferState PUTTING
Indicates that theIBuffercan provide aByteBufferthat can be used for putting data.A transition to
WRITINGcan be triggered by callingIBuffer.write(SocketChannel).A transition to
GETTINGcan be triggered by callingIBuffer.flip().A transition to
INITIALcan be triggered by callingIBuffer.clear().
-
WRITING
public static final BufferState WRITING
Indicates that theIBufferis currently writing its data to aSocketChannel.Self transitions to
WRITINGcan be triggered by repeatedly callingIBuffer.write(SocketChannel)until it returnstrue.A transition to
INITIALcan be triggered by callingIBuffer.clear().
-
READING_HEADER
public static final BufferState READING_HEADER
Indicates that theIBufferis currently reading its header from aSocketChannel.Transitions to
READING_HEADER,READING_BODYorGETTINGcan be triggered by repeatedly callingIBuffer.startGetting(SocketChannel)until it returns aByteBufferthat can be used for getting data.A transition to
INITIALcan be triggered by callingIBuffer.clear().
-
READING_BODY
public static final BufferState READING_BODY
Indicates that theIBufferis currently reading its body from aSocketChannel.Transitions to
READING_BODYorGETTINGcan be triggered by repeatedly callingIBuffer.startGetting(SocketChannel)until it returns aByteBufferthat can be used for getting data.A transition to
INITIALcan be triggered by callingIBuffer.clear().
-
GETTING
public static final BufferState GETTING
Indicates that theIBuffercan provide aByteBufferthat can be used for getting data.A transition to
INITIALcan be triggered by callingIBuffer.clear().
-
RELEASED
public static final BufferState RELEASED
Indicates that theIBufferis owned by itsIBufferProvider.- Since:
- 3.0
-
DISPOSED
public static final BufferState DISPOSED
Indicates that theIBuffercan not be used anymore.- Since:
- 3.0
-
-
Method Detail
-
values
public static BufferState[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (BufferState c : BufferState.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static BufferState valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
-