Methods Summary |
---|
public int | capacity(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_CAPACITY );
}
return( buffer.capacity());
|
public void | clear(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_CLEAR );
}
buffer.clear();
|
protected void | dumpTrace(java.lang.Throwable e)
if ( TRACE ){
System.out.println( getTraceString());
Ignore.ignore(e);
}
|
public void | flip(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_FLIP );
}
buffer.flip();
|
public byte | get(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_GET);
}
return( buffer.get());
|
public byte | get(byte subsystem, int x)
if ( TRACE ){
traceUsage( subsystem, OP_GET_INT);
}
return( buffer.get(x));
|
public void | get(byte subsystem, byte[] data)
if ( TRACE ){
traceUsage( subsystem, OP_GET_BYTEARRAY);
}
buffer.get(data);
|
protected byte | getAllocator()
return( allocator );
|
public java.nio.ByteBuffer | getBuffer(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_GETBUFFER );
}
return( buffer );
|
protected java.nio.ByteBuffer | getBufferInternal()
return( buffer );
|
public int | getInt(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_GETINT);
}
return( buffer.getInt());
|
public int | getInt(byte subsystem, int x)
if ( TRACE ){
traceUsage( subsystem, OP_GETINT_INT );
}
return( buffer.getInt(x));
|
public ReferenceCountedDirectByteBuffer | getReferenceCountedBuffer()
ReferenceCountedDirectByteBuffer res = new ReferenceCountedDirectByteBuffer( this );
return( res );
|
public short | getShort(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_GETSHORT);
}
return( buffer.getShort());
|
protected java.lang.String | getTraceString()
if ( TRACE ){
/*
StringBuffer sb = new StringBuffer();
sb.append( AL_DESCS[allocator]);
sb.append( ":" );
boolean wrapped = false;
int start = 0;
int end = trace_buffer_pos;
if ( trace_buffer[trace_buffer_pos] != 0 ){
start = trace_buffer_pos;
wrapped = true;
}
if ( end == 0 && !wrapped ){
sb.append( "not used");
}else{
if ( wrapped ){
sb.append( "*" );
}
int num = 0;
do{
if ( num++ > 0 ){
sb.append(",");
}
sb.append( SS_DESCS[trace_buffer[start++]]);
sb.append( "/" );
sb.append( OP_DESCS[trace_buffer[start++]]);
if ( start == TRACE_BUFFER_SIZE ){
start = 0;
}
}while( start != end );
}
return( sb.toString());
*/
}
return( null );
|
public boolean | hasRemaining(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_HASREMAINING );
}
return( buffer.hasRemaining());
|
public int | limit(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_LIMIT );
}
return( buffer.limit());
|
public void | limit(byte subsystem, int l)
if ( TRACE ){
traceUsage( subsystem, OP_LIMIT_INT );
}
buffer.limit(l);
|
public int | position(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_POSITION);
}
return( buffer.position());
|
public void | position(byte subsystem, int l)
if ( TRACE ){
traceUsage( subsystem, OP_POSITION_INT);
}
buffer.position(l);
|
public void | put(byte subsystem, byte[] data)
if ( TRACE ){
traceUsage( subsystem, OP_PUT_BYTEARRAY );
}
buffer.put( data );
|
public void | put(byte subsystem, org.gudy.azureus2.core3.util.DirectByteBuffer data)
if ( TRACE ){
traceUsage( subsystem, OP_PUT_DBB);
}
buffer.put( data.buffer );
|
public void | put(byte subsystem, java.nio.ByteBuffer data)
if ( TRACE ){
traceUsage( subsystem, OP_PUT_BB);
}
buffer.put( data );
|
public void | put(byte subsystem, byte data)
if ( TRACE ){
traceUsage( subsystem, OP_PUT_BYTE );
}
buffer.put( data );
|
public void | putInt(byte subsystem, int data)
if ( TRACE ){
traceUsage( subsystem, OP_PUTINT);
}
buffer.putInt( data );
|
public void | putShort(byte subsystem, short x)
if ( TRACE ){
traceUsage( subsystem, OP_PUTSHORT);
}
buffer.putShort( x );
|
public int | read(byte subsystem, java.nio.channels.FileChannel chan)
if ( TRACE ){
traceUsage( subsystem, OP_READ_FC);
}
try{
return( chan.read(buffer ));
}catch( IllegalArgumentException e ){
dumpTrace(e);
throw( e );
}
|
public int | read(byte subsystem, java.nio.channels.SocketChannel chan)
if ( TRACE ){
traceUsage( subsystem, OP_READ_SC );
}
try{
return( chan.read(buffer ));
}catch( IllegalArgumentException e ){
dumpTrace(e);
throw( e );
}
|
public int | remaining(byte subsystem)
if ( TRACE ){
traceUsage( subsystem, OP_REMANING );
}
return( buffer.remaining());
|
public void | returnToPool()
if ( pool != null ){
// we can't afford to return a buffer more than once to the pool as it'll get
// handed out twice in parallel and cause weird problems. We haven't been able
// to totally eliminiate duplicate returnToPool calls....
synchronized( this ){
if ( buffer == null ){
Debug.out( "Buffer already returned to pool");
}else{
pool.returnBuffer( this );
buffer = null;
}
}
}
|
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
if ( pool != null ){
// we can't afford to return a buffer more than once to the pool as it'll get
// handed out twice in parallel and cause weird problems. We haven't been able
// to totally eliminiate duplicate returnToPool calls....
synchronized( this ){
if ( buffer != null ){
pool.returnBuffer( this );
buffer = null;
}
}
}
|
protected void | traceUsage(byte subsystem, byte operation)
if ( TRACE ){
/*
trace_buffer[trace_buffer_pos++] = subsystem;
trace_buffer[trace_buffer_pos++] = operation;
if ( trace_buffer_pos == TRACE_BUFFER_SIZE ){
trace_buffer_pos = 0;
}
*/
}
|
public int | write(byte subsystem, java.nio.channels.FileChannel chan)
if ( TRACE ){
traceUsage( subsystem, OP_WRITE_FC );
}
try{
return( chan.write(buffer ));
}catch( IllegalArgumentException e ){
dumpTrace(e);
throw( e );
}
|
public int | write(byte subsystem, java.nio.channels.SocketChannel chan)
if ( TRACE ){
traceUsage( subsystem, OP_WRITE_SC );
}
try{
return( chan.write(buffer ));
}catch( IllegalArgumentException e ){
dumpTrace(e);
throw( e );
}
|