Class NettyBufferFactory
- java.lang.Object
-
- org.apache.tinkerpop.gremlin.util.ser.NettyBufferFactory
-
- All Implemented Interfaces:
BufferFactory<io.netty.buffer.ByteBuf>
public class NettyBufferFactory extends Object implements BufferFactory<io.netty.buffer.ByteBuf>
Represents a factory to createBufferinstances from wrappedByteBufinstances.
-
-
Constructor Summary
Constructors Constructor Description NettyBufferFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Buffercreate(io.netty.buffer.ByteBuf value)Creates a newBuffergiven aBufferFactoryinstance.static voidreadRaw(Buffer buffer, Consumer<io.netty.buffer.ByteBuf> consumer)Utility method to allow reading from the underlying bytes using a NettyByteBufinstance for interoperability, advancing the reader index of theBufferafter the consumer is called.Bufferwrap(ByteBuffer value)Wraps a NIO buffer.static voidwriteRaw(Buffer buffer, Consumer<io.netty.buffer.ByteBuf> consumer)Allows writing from the underlying bytes using a NettyByteBufinstance for interoperability, advancing the writer index of theBufferafter the consumer is called.
-
-
-
Method Detail
-
create
public Buffer create(io.netty.buffer.ByteBuf value)
Description copied from interface:BufferFactoryCreates a newBuffergiven aBufferFactoryinstance.- Specified by:
createin interfaceBufferFactory<io.netty.buffer.ByteBuf>- Returns:
-
wrap
public Buffer wrap(ByteBuffer value)
Description copied from interface:BufferFactoryWraps a NIO buffer.- Specified by:
wrapin interfaceBufferFactory<io.netty.buffer.ByteBuf>
-
readRaw
public static void readRaw(Buffer buffer, Consumer<io.netty.buffer.ByteBuf> consumer)
Utility method to allow reading from the underlying bytes using a NettyByteBufinstance for interoperability, advancing the reader index of theBufferafter the consumer is called. Note that theByteBufused by the consumer should not be released by the caller. In case the providedBufferinstance is not aNettyBuffer, it will create aByteBufwrapper for the consumer to use, releasing it after use.
-
writeRaw
public static void writeRaw(Buffer buffer, Consumer<io.netty.buffer.ByteBuf> consumer)
Allows writing from the underlying bytes using a NettyByteBufinstance for interoperability, advancing the writer index of theBufferafter the consumer is called. Note that theByteBufused by the consumer should not be released by the caller. In case the providedBufferinstance is not aNettyBuffer, it will create aByteBufwrapper for the consumer to use, releasing it after use.
-
-