public class ShareableBytes
extends java.lang.Object
BufferPools.forNetworking()
managed, ByteBuffer
;
optimised for the case where no sharing is necessary.
When sharing is necessary, share()
method must be invoked by the owning thread
before a ShareableBytes
instance can be shared with another thread.Modifier and Type | Method and Description |
---|---|
java.nio.ByteBuffer |
get() |
boolean |
hasRemaining() |
void |
release() |
int |
remaining() |
ShareableBytes |
share()
Ensure this ShareableBytes will use atomic operations for updating its count from now on.
|
ShareableBytes |
sliceAndConsume(int length)
Create a slice over the next
length bytes, consuming them from our buffer, and incrementing the owner count |
static ShareableBytes |
wrap(java.nio.ByteBuffer buffer) |
public java.nio.ByteBuffer get()
public boolean hasRemaining()
public int remaining()
public ShareableBytes share()
public void release()
public ShareableBytes sliceAndConsume(int length)
length
bytes, consuming them from our buffer, and incrementing the owner countpublic static ShareableBytes wrap(java.nio.ByteBuffer buffer)
Copyright © 2009-2021 The Apache Software Foundation