java.lang.Object
org.activemq.io.util.DataContainer
- class DataContainer
- extends java.lang.Object
A DataContainer handles file persistence for a DiskBoundedQueue
The DataContainer is a temporary data structure, that is only
designed to exist for the lifetime of the application
- Version:
- $Revision: 1.1.1.1 $
|
Method Summary |
void |
close()
close the DataContainer and corresponding FileDataBlocks |
private FileDataBlock |
createDataBlock(int sequence)
create a FileDataBlock |
(package private) void |
deleteAll()
Delete all previous files of the same suffix in the directory |
boolean |
isEmpty()
|
long |
length()
|
byte[] |
read()
read a block of data from the container |
int |
size()
|
void |
write(byte[] data)
write a block of data into the Container |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dataBlocks
private CopyOnWriteArrayList dataBlocks
writeBlock
private FileDataBlock writeBlock
readBlock
private FileDataBlock readBlock
dir
private java.io.File dir
length
private long length
size
private int size
name
private java.lang.String name
maxBlockSize
private int maxBlockSize
sequence
private int sequence
SUFFIX
private static final java.lang.String SUFFIX
- See Also:
- Constant Field Values
log
private static final org.apache.commons.logging.Log log
DataContainer
DataContainer(java.io.File dir,
java.lang.String name,
int maxBlockSize)
throws java.io.IOException
- Constructor for the data container
deleteAll
void deleteAll()
- Delete all previous files of the same suffix in the directory
isEmpty
public boolean isEmpty()
length
public long length()
size
public int size()
write
public void write(byte[] data)
throws java.io.IOException
- write a block of data into the Container
read
public byte[] read()
throws java.io.IOException
- read a block of data from the container
close
public void close()
throws java.io.IOException
- close the DataContainer and corresponding FileDataBlocks
createDataBlock
private FileDataBlock createDataBlock(int sequence)
throws java.io.IOException
- create a FileDataBlock