FileDocCategorySizeDatePackage
PooledByteBufferImpl.javaAPI DocAzureus 3.0.3.42525Tue Jun 20 03:09:02 BST 2006org.gudy.azureus2.pluginsimpl.local.utils

PooledByteBufferImpl

public class PooledByteBufferImpl extends Object implements org.gudy.azureus2.plugins.utils.PooledByteBuffer

Fields Summary
private org.gudy.azureus2.core3.util.DirectByteBuffer
buffer
Constructors Summary
public PooledByteBufferImpl(org.gudy.azureus2.core3.util.DirectByteBuffer _buffer)

		buffer	= _buffer;
	
public PooledByteBufferImpl(int size)

		buffer = DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_EXTERNAL, size );
	
public PooledByteBufferImpl(byte[] data)

		buffer = DirectByteBufferPool.getBuffer( DirectByteBuffer.AL_EXTERNAL, data.length );
		
		buffer.put( DirectByteBuffer.AL_EXTERNAL, data );
		
		buffer.position( DirectByteBuffer.AL_EXTERNAL, 0 );
	
Methods Summary
public org.gudy.azureus2.core3.util.DirectByteBuffergetBuffer()

		return( buffer );
	
public voidreturnToPool()

		buffer.returnToPool();
	
public byte[]toByteArray()

		buffer.position( DirectByteBuffer.SS_EXTERNAL, 0 );
		
		int	len = buffer.limit( DirectByteBuffer.SS_EXTERNAL );
		
		byte[]	res = new byte[len];
		
		buffer.get( DirectByteBuffer.SS_EXTERNAL, res );
		
		buffer.position( DirectByteBuffer.SS_EXTERNAL, 0 );

		return( res );
	
public java.nio.ByteBuffertoByteBuffer()

		return( buffer.getBuffer( DirectByteBuffer.SS_EXTERNAL ));
	
public java.util.MaptoMap()

		return( BDecoder.decode( toByteArray()));