org.eclipse.webdav.http.client
Class BufferPool
java.lang.Object
org.eclipse.webdav.http.client.BufferPool
public class BufferPool
- extends Object
A BufferPool
holds on to a collection of buffers (byte
arrays) so they can be reused without having to allocate and release
memory.
Note: This class/interface is part of an interim API that is still under
development and expected to change significantly before reaching stability.
It is being made available at this early stage to solicit feedback from pioneering
adopters on the understanding that any code that uses this API will almost
certainly be broken (repeatedly) as the API evolves.
Method Summary |
byte[] |
getBuffer()
Returns a buffer (byte array) of size BUFFER_SIZE from the
pool. |
void |
putBuffer(byte[] buffer)
Puts the given buffer into the pool for future use. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BufferPool
public BufferPool()
getBuffer
public byte[] getBuffer()
- Returns a buffer (byte array) of size
BUFFER_SIZE
from the
pool. When the buffer is no longer needed, it should be put back in the
pool for future use by calling putBuffer
.
- Returns:
- a buffer
- See Also:
putBuffer(byte[])
putBuffer
public void putBuffer(byte[] buffer)
- Puts the given buffer into the pool for future use. The size of the
buffer must be
BUFFER_SIZE
.
- Parameters:
buffer
- the buffer to be put back into the buffer pool- See Also:
getBuffer()
Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.