Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.io.util
Class DataContainer  view DataContainer download DataContainer.java

java.lang.Object
  extended byorg.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 $

Field Summary
private  CopyOnWriteArrayList dataBlocks
           
private  java.io.File dir
           
private  long length
           
private static org.apache.commons.logging.Log log
           
private  int maxBlockSize
           
private  java.lang.String name
           
private  FileDataBlock readBlock
           
private  int sequence
           
private  int size
           
private static java.lang.String SUFFIX
           
private  FileDataBlock writeBlock
           
 
Constructor Summary
(package private) DataContainer(java.io.File dir, java.lang.String name, int maxBlockSize)
          Constructor for the data container
 
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
 

Field Detail

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
Constructor Detail

DataContainer

DataContainer(java.io.File dir,
              java.lang.String name,
              int maxBlockSize)
        throws java.io.IOException
Constructor for the data container

Method Detail

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