Package com.biglybt.core.util
Class DirectByteBuffer
java.lang.Object
com.biglybt.core.util.DirectByteBuffer
- Direct Known Subclasses:
DirectByteBufferPoolReal.sliceDBB
,ReferenceCountedDirectByteBuffer
Virtual direct byte buffer given out and tracker
by the buffer pool.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
static final byte
static final String[]
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
private byte
private ByteBuffer
static final byte
static final byte
private byte
static final byte
static final byte
static final String[]
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
private DirectByteBufferPool
static final byte
static final byte
static final String[]
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
protected static final boolean
protected static final int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDirectByteBuffer
(byte _allocator, ByteBuffer _buffer, DirectByteBufferPool _pool) protected
DirectByteBuffer
(DirectByteBuffer basis) constructor for reference counted versionDirectByteBuffer
(ByteBuffer _buffer) -
Method Summary
Modifier and TypeMethodDescriptionint
capacity
(byte subsystem) void
clear
(byte subsystem) protected void
void
flip
(byte subsystem) byte
get
(byte subsystem) void
get
(byte subsystem, byte[] data) byte
get
(byte subsystem, int x) protected byte
getBuffer
(byte subsystem) protected ByteBuffer
boolean
getFlag
(byte flag) int
getInt
(byte subsystem) int
getInt
(byte subsystem, int x) short
getShort
(byte subsystem) protected String
boolean
boolean
hasRemaining
(byte subsystem) int
limit
(byte subsystem) void
limit
(byte subsystem, int l) int
position
(byte subsystem) void
position
(byte subsystem, int l) void
put
(byte subsystem, byte data) void
put
(byte subsystem, byte[] data) void
put
(byte subsystem, byte[] data, int offset, int length) void
put
(byte subsystem, DirectByteBuffer data) void
put
(byte subsystem, ByteBuffer data) void
putInt
(byte subsystem, int data) void
putShort
(byte subsystem, short x) int
read
(byte subsystem, FileChannel chan) int
read
(byte subsystem, SocketChannel chan) int
remaining
(byte subsystem) void
void
Normally you should know when a buffer is/isn't free and NOT CALL THIS METHOD However, there are some error situations where the existing code doesn't correctly manage things - we know this and don't want spurious logs occuring as per the above normal methodvoid
setFlag
(byte flag) protected void
traceUsage
(byte subsystem, byte operation) int
write
(byte subsystem, FileChannel chan) int
write
(byte subsystem, SocketChannel chan)
-
Field Details
-
AL_NONE
public static final byte AL_NONE- See Also:
-
AL_EXTERNAL
public static final byte AL_EXTERNAL- See Also:
-
AL_OTHER
public static final byte AL_OTHER- See Also:
-
AL_PT_READ
public static final byte AL_PT_READ- See Also:
-
AL_PT_LENGTH
public static final byte AL_PT_LENGTH- See Also:
-
AL_CACHE_READ
public static final byte AL_CACHE_READ- See Also:
-
AL_DM_READ
public static final byte AL_DM_READ- See Also:
-
AL_DM_ZERO
public static final byte AL_DM_ZERO- See Also:
-
AL_DM_CHECK
public static final byte AL_DM_CHECK- See Also:
-
AL_BT_PIECE
public static final byte AL_BT_PIECE- See Also:
-
AL_CACHE_WRITE
public static final byte AL_CACHE_WRITE- See Also:
-
AL_PROXY_RELAY
public static final byte AL_PROXY_RELAY- See Also:
-
AL_MSG
public static final byte AL_MSG- See Also:
-
AL_MSG_AZ_HAND
public static final byte AL_MSG_AZ_HAND- See Also:
-
AL_MSG_AZ_PEX
public static final byte AL_MSG_AZ_PEX- See Also:
-
AL_MSG_BT_CANCEL
public static final byte AL_MSG_BT_CANCEL- See Also:
-
AL_MSG_BT_HAND
public static final byte AL_MSG_BT_HAND- See Also:
-
AL_MSG_BT_HAVE
public static final byte AL_MSG_BT_HAVE- See Also:
-
AL_MSG_BT_PIECE
public static final byte AL_MSG_BT_PIECE- See Also:
-
AL_MSG_BT_REQUEST
public static final byte AL_MSG_BT_REQUEST- See Also:
-
AL_MSG_BT_KEEPALIVE
public static final byte AL_MSG_BT_KEEPALIVE- See Also:
-
AL_MSG_BT_HEADER
public static final byte AL_MSG_BT_HEADER- See Also:
-
AL_MSG_AZ_HEADER
public static final byte AL_MSG_AZ_HEADER- See Also:
-
AL_MSG_BT_PAYLOAD
public static final byte AL_MSG_BT_PAYLOAD- See Also:
-
AL_MSG_AZ_PAYLOAD
public static final byte AL_MSG_AZ_PAYLOAD- See Also:
-
AL_FILE
public static final byte AL_FILE- See Also:
-
AL_NET_CRYPT
public static final byte AL_NET_CRYPT- See Also:
-
AL_MSG_LT_EXT_MESSAGE
public static final byte AL_MSG_LT_EXT_MESSAGE- See Also:
-
AL_MSG_LT_HANDSHAKE
public static final byte AL_MSG_LT_HANDSHAKE- See Also:
-
AL_MSG_UT_PEX
public static final byte AL_MSG_UT_PEX- See Also:
-
AL_MSG_BT_DHT_PORT
public static final byte AL_MSG_BT_DHT_PORT- See Also:
-
AL_MSG_BT_REJECT_REQUEST
public static final byte AL_MSG_BT_REJECT_REQUEST- See Also:
-
AL_MSG_BT_SUGGEST_PIECE
public static final byte AL_MSG_BT_SUGGEST_PIECE- See Also:
-
AL_MSG_BT_ALLOWED_FAST
public static final byte AL_MSG_BT_ALLOWED_FAST- See Also:
-
AL_MSG_UT_METADATA
public static final byte AL_MSG_UT_METADATA- See Also:
-
AL_MSG_AZ_METADATA
public static final byte AL_MSG_AZ_METADATA- See Also:
-
AL_MSG_UT_UPLOAD_ONLY
public static final byte AL_MSG_UT_UPLOAD_ONLY- See Also:
-
AL_MSG_BT_HASH_REQUEST
public static final byte AL_MSG_BT_HASH_REQUEST- See Also:
-
AL_MSG_BT_HASHES
public static final byte AL_MSG_BT_HASHES- See Also:
-
AL_MSG_BT_HASH_REJECT
public static final byte AL_MSG_BT_HASH_REJECT- See Also:
-
AL_MSG_UT_HOLEPUNCH
public static final byte AL_MSG_UT_HOLEPUNCH- See Also:
-
AL_DESCS
-
SS_NONE
public static final byte SS_NONE- See Also:
-
SS_EXTERNAL
public static final byte SS_EXTERNAL- See Also:
-
SS_OTHER
public static final byte SS_OTHER- See Also:
-
SS_CACHE
public static final byte SS_CACHE- See Also:
-
SS_FILE
public static final byte SS_FILE- See Also:
-
SS_NET
public static final byte SS_NET- See Also:
-
SS_BT
public static final byte SS_BT- See Also:
-
SS_DR
public static final byte SS_DR- See Also:
-
SS_DW
public static final byte SS_DW- See Also:
-
SS_PEER
public static final byte SS_PEER- See Also:
-
SS_PROXY
public static final byte SS_PROXY- See Also:
-
SS_MSG
public static final byte SS_MSG- See Also:
-
SS_DESCS
-
OP_LIMIT
public static final byte OP_LIMIT- See Also:
-
OP_LIMIT_INT
public static final byte OP_LIMIT_INT- See Also:
-
OP_POSITION
public static final byte OP_POSITION- See Also:
-
OP_POSITION_INT
public static final byte OP_POSITION_INT- See Also:
-
OP_CLEAR
public static final byte OP_CLEAR- See Also:
-
OP_FLIP
public static final byte OP_FLIP- See Also:
-
OP_REMANING
public static final byte OP_REMANING- See Also:
-
OP_CAPACITY
public static final byte OP_CAPACITY- See Also:
-
OP_PUT_BYTEARRAY
public static final byte OP_PUT_BYTEARRAY- See Also:
-
OP_PUT_DBB
public static final byte OP_PUT_DBB- See Also:
-
OP_PUT_BB
public static final byte OP_PUT_BB- See Also:
-
OP_PUTINT
public static final byte OP_PUTINT- See Also:
-
OP_PUT_BYTE
public static final byte OP_PUT_BYTE- See Also:
-
OP_GET
public static final byte OP_GET- See Also:
-
OP_GET_INT
public static final byte OP_GET_INT- See Also:
-
OP_GET_BYTEARRAY
public static final byte OP_GET_BYTEARRAY- See Also:
-
OP_GETINT
public static final byte OP_GETINT- See Also:
-
OP_GETINT_INT
public static final byte OP_GETINT_INT- See Also:
-
OP_HASREMAINING
public static final byte OP_HASREMAINING- See Also:
-
OP_READ_FC
public static final byte OP_READ_FC- See Also:
-
OP_WRITE_FC
public static final byte OP_WRITE_FC- See Also:
-
OP_READ_SC
public static final byte OP_READ_SC- See Also:
-
OP_WRITE_SC
public static final byte OP_WRITE_SC- See Also:
-
OP_GETBUFFER
public static final byte OP_GETBUFFER- See Also:
-
OP_GETSHORT
public static final byte OP_GETSHORT- See Also:
-
OP_PUTSHORT
public static final byte OP_PUTSHORT- See Also:
-
OP_DESCS
-
FL_NONE
public static final byte FL_NONE- See Also:
-
FL_CONTAINS_TRANSIENT_DATA
public static final byte FL_CONTAINS_TRANSIENT_DATA- See Also:
-
TRACE
protected static final boolean TRACE- See Also:
-
TRACE_BUFFER_SIZE
protected static final int TRACE_BUFFER_SIZE- See Also:
-
buffer
-
pool
-
allocator
private byte allocator -
flags
private byte flags
-
-
Constructor Details
-
DirectByteBuffer
-
DirectByteBuffer
-
DirectByteBuffer
constructor for reference counted version- Parameters:
basis
-
-
-
Method Details
-
getReferenceCountedBuffer
-
setFlag
public void setFlag(byte flag) -
getFlag
public boolean getFlag(byte flag) -
traceUsage
protected void traceUsage(byte subsystem, byte operation) -
getTraceString
-
dumpTrace
-
getBufferInternal
-
getAllocator
protected byte getAllocator() -
limit
public int limit(byte subsystem) -
limit
public void limit(byte subsystem, int l) -
position
public int position(byte subsystem) -
position
public void position(byte subsystem, int l) -
clear
public void clear(byte subsystem) -
flip
public void flip(byte subsystem) -
remaining
public int remaining(byte subsystem) -
capacity
public int capacity(byte subsystem) -
put
public void put(byte subsystem, byte[] data) -
put
public void put(byte subsystem, byte[] data, int offset, int length) -
put
-
put
-
put
public void put(byte subsystem, byte data) -
putShort
public void putShort(byte subsystem, short x) -
putInt
public void putInt(byte subsystem, int data) -
get
public byte get(byte subsystem) -
get
public byte get(byte subsystem, int x) -
get
public void get(byte subsystem, byte[] data) -
getShort
public short getShort(byte subsystem) -
getInt
public int getInt(byte subsystem) -
getInt
public int getInt(byte subsystem, int x) -
hasRemaining
public boolean hasRemaining(byte subsystem) -
read
- Throws:
IOException
-
write
- Throws:
IOException
-
read
- Throws:
IOException
-
write
- Throws:
IOException
-
getBuffer
-
returnToPool
public void returnToPool() -
hasBeenReturnedToPool
public boolean hasBeenReturnedToPool() -
returnToPoolIfNotFree
public void returnToPoolIfNotFree()Normally you should know when a buffer is/isn't free and NOT CALL THIS METHOD However, there are some error situations where the existing code doesn't correctly manage things - we know this and don't want spurious logs occuring as per the above normal method
-