org.apache.commons.collections.buffer
Class SynchronizedBuffer
- Buffer, Collection, Serializable
public class SynchronizedBuffer
Decorates another
Buffer
to synchronize its behaviour
for a multi-threaded environment.
Methods are synchronized, then forwarded to the decorated buffer.
This class is Serializable from Commons Collections 3.1.
Version:
- Stephen Colebourne
- Commons Collections 3.0
static Buffer | decorate(Buffer buffer) - Factory method to create a synchronized buffer.
|
Object | get() - Gets the next object from the buffer without removing it.
|
protected Buffer | getBuffer() - Gets the buffer being decorated.
|
Object | remove() - Gets and removes the next object from the buffer.
|
add , addAll , clear , contains , containsAll , decorate , equals , hashCode , isEmpty , iterator , remove , removeAll , retainAll , size , toArray , toArray , toString |
SynchronizedBuffer
protected SynchronizedBuffer(Buffer buffer)
Constructor that wraps (not copies).
buffer
- the buffer to decorate, must not be null
SynchronizedBuffer
protected SynchronizedBuffer(Buffer buffer,
Object lock)
Constructor that wraps (not copies).
buffer
- the buffer to decorate, must not be nulllock
- the lock object to use, must not be null
decorate
public static Buffer decorate(Buffer buffer)
Factory method to create a synchronized buffer.
buffer
- the buffer to decorate, must not be null
- a new synchronized Buffer
get
public Object get()
Gets the next object from the buffer without removing it.
- get in interface Buffer
- the next object in the buffer, which is not removed
getBuffer
protected Buffer getBuffer()
Gets the buffer being decorated.
- the decorated buffer
remove
public Object remove()
Gets and removes the next object from the buffer.
- remove in interface Buffer
- the next object in the buffer, which is also removed
Copyright © 2001-2005 Apache Software Foundation. All Rights Reserved.