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 DISPOSED
Indicates that theIBuffer
can not be used anymore.GETTING
Indicates that theIBuffer
can provide aByteBuffer
that can be used for getting data.INITIAL
Indicates that theIBuffer
has just been provided by itsIBufferProvider
or that is has been used and subsequentlycleared
.PUTTING
Indicates that theIBuffer
can provide aByteBuffer
that can be used for putting data.READING_BODY
Indicates that theIBuffer
is currently reading its body from aSocketChannel
.READING_HEADER
Indicates that theIBuffer
is currently reading its header from aSocketChannel
.RELEASED
Indicates that theIBuffer
is owned by itsIBufferProvider
.WRITING
Indicates that theIBuffer
is currently writing its data to aSocketChannel
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BufferState
valueOf(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 theIBuffer
has just been provided by itsIBufferProvider
or that is has been used and subsequentlycleared
.A transition to
PUTTING
can be triggered by callingIBuffer.startPutting(short)
once. If the buffer is intended to be passed to anIChannel
later thechannel index
of that Channel has to be passed because it is part of the buffer's header. AByteBuffer
is returned that can be used for putting data.A transition to
GETTING
can be triggered by callingIBuffer.startGetting(SocketChannel)
repeatedly until it finally returns aByteBuffer
that can be used for getting data.
-
PUTTING
public static final BufferState PUTTING
Indicates that theIBuffer
can provide aByteBuffer
that can be used for putting data.A transition to
WRITING
can be triggered by callingIBuffer.write(SocketChannel)
.A transition to
GETTING
can be triggered by callingIBuffer.flip()
.A transition to
INITIAL
can be triggered by callingIBuffer.clear()
.
-
WRITING
public static final BufferState WRITING
Indicates that theIBuffer
is currently writing its data to aSocketChannel
.Self transitions to
WRITING
can be triggered by repeatedly callingIBuffer.write(SocketChannel)
until it returnstrue
.A transition to
INITIAL
can be triggered by callingIBuffer.clear()
.
-
READING_HEADER
public static final BufferState READING_HEADER
Indicates that theIBuffer
is currently reading its header from aSocketChannel
.Transitions to
READING_HEADER
,READING_BODY
orGETTING
can be triggered by repeatedly callingIBuffer.startGetting(SocketChannel)
until it returns aByteBuffer
that can be used for getting data.A transition to
INITIAL
can be triggered by callingIBuffer.clear()
.
-
READING_BODY
public static final BufferState READING_BODY
Indicates that theIBuffer
is currently reading its body from aSocketChannel
.Transitions to
READING_BODY
orGETTING
can be triggered by repeatedly callingIBuffer.startGetting(SocketChannel)
until it returns aByteBuffer
that can be used for getting data.A transition to
INITIAL
can be triggered by callingIBuffer.clear()
.
-
GETTING
public static final BufferState GETTING
Indicates that theIBuffer
can provide aByteBuffer
that can be used for getting data.A transition to
INITIAL
can be triggered by callingIBuffer.clear()
.
-
RELEASED
public static final BufferState RELEASED
Indicates that theIBuffer
is owned by itsIBufferProvider
.- Since:
- 3.0
-
DISPOSED
public static final BufferState DISPOSED
Indicates that theIBuffer
can 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
-
-