Package com.linecorp.armeria.common
Enum ByteBufAccessMode
- All Implemented Interfaces:
Serializable
,Comparable<ByteBufAccessMode>
,java.lang.constant.Constable
@UnstableApi public enum ByteBufAccessMode extends Enum<ByteBufAccessMode>
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and Type Method Description static ByteBufAccessMode
valueOf(String name)
Returns the enum constant of this type with the specified name.static ByteBufAccessMode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
DUPLICATE
Gets the duplicate (or slice) of the underlyingByteBuf
. This mode is useful when you access theByteBuf
within the life cycle of theHttpData
:try (HttpData content = ...) { ByteBuf buf = content.byteBuf(ByteBufAccessMode.DUPLICATE); // Read something from 'buf' here. }
- See Also:
ByteBuf.duplicate()
,ByteBuf.slice()
-
RETAINED_DUPLICATE
Gets the retained duplicate (or slice) of the underlyingByteBuf
. This mode is useful when you access theByteBuf
beyond the life cycle of theHttpData
, such as creating anotherHttpData
that shares theByteBuf
's memory region:HttpData data1 = HttpData.wrap(byteBuf); HttpData data2 = HttpData.wrap(data1.byteBuf(ByteBufAccessMode.RETAINED_DUPLICATE));
-
FOR_IO
Converts the underlyingByteBuf
into a directByteBuf
if necessary. If the underlyingByteBuf
is already direct, it behaves same withRETAINED_DUPLICATE
. Otherwise, a new directByteBuf
is allocated and the content of the underlyingByteBuf
is copied into it. This access mode is useful when you perform direct I/O or send data to a NettyChannel
.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-