TrueZIP Kernel 7.0-rc2

de.schlichtherle.truezip.socket
Class ByteArrayIOPool

java.lang.Object
  extended by de.schlichtherle.truezip.socket.ByteArrayIOPool
All Implemented Interfaces:
IOPool<ByteArrayIOEntry>, Pool<IOPool.Entry<ByteArrayIOEntry>,IOException>

@ThreadSafe
public final class ByteArrayIOPool
extends Object
implements IOPool<ByteArrayIOEntry>

A pool of byte array I/O entries.

Author:
Christian Schlichtherle

Nested Class Summary
 class ByteArrayIOPool.Entry
           
 
Nested classes/interfaces inherited from interface de.schlichtherle.truezip.util.Pool
Pool.Releasable<E extends Exception>
 
Field Summary
private  int active
           
private  int initialCapacity
           
private static String MOCK_ENTRY_NAME
           
private  int total
           
 
Constructor Summary
ByteArrayIOPool()
          Equivalent to new ByteArrayIOPool(32).
ByteArrayIOPool(int initialCapacity)
          Constructs a new byte array I/O pool.
 
Method Summary
 ByteArrayIOPool.Entry allocate()
          Allocates a resource from this pool.
 int getSize()
          Returns the number of I/O entries allocated but not yet released from this pool.
 void release(IOPool.Entry<ByteArrayIOEntry> entry)
          Releases a previously allocated resource to this pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOCK_ENTRY_NAME

private static final String MOCK_ENTRY_NAME
See Also:
Constant Field Values

initialCapacity

private final int initialCapacity

total

private volatile int total

active

private volatile int active
Constructor Detail

ByteArrayIOPool

public ByteArrayIOPool()
Equivalent to new ByteArrayIOPool(32).


ByteArrayIOPool

public ByteArrayIOPool(int initialCapacity)
Constructs a new byte array I/O pool.

Parameters:
initialCapacity - the initial capacity of the array to use for writing to an allocated I/O entry.
Method Detail

allocate

public ByteArrayIOPool.Entry allocate()
Description copied from interface: Pool
Allocates a resource from this pool.

Specified by:
allocate in interface Pool<IOPool.Entry<ByteArrayIOEntry>,IOException>
Returns:
A resource.

release

public void release(IOPool.Entry<ByteArrayIOEntry> entry)
             throws IOException
Description copied from interface: Pool
Releases a previously allocated resource to this pool. Implementations may throw an IllegalArgumentException or an IllegalStateException upon the conditions explained below.

Specified by:
release in interface Pool<IOPool.Entry<ByteArrayIOEntry>,IOException>
Parameters:
entry - a resource.
Throws:
IOException

getSize

public int getSize()
Returns the number of I/O entries allocated but not yet released from this pool.

Returns:
The number of I/O entries allocated but not yet released from this pool.

TrueZIP Kernel 7.0-rc2

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.