org.codehaus.activemq.message.util
Class DataContainer

java.lang.Object
  extended byorg.codehaus.activemq.message.util.DataContainer

class DataContainer
extends 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 $

Constructor Summary
(package private) DataContainer(File dir, String name, int maxBlockSize)
          Constructor for the data container
 
Method Summary
 void close()
          close the DataContainer and corresponding FileDataBlocks
(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
 

Constructor Detail

DataContainer

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

Parameters:
dir - directory where to create the data blocks
name - for the data block names
maxBlockSize - maximum size (in bytes) of the data blocks
Throws:
IOException
Method Detail

deleteAll

void deleteAll()
Delete all previous files of the same suffix in the directory


isEmpty

public boolean isEmpty()
Returns:
true if this DataContainer is empty

length

public long length()
Returns:
the length (in bytes) of unread data in the DataContainer

size

public int size()
Returns:
the number of data entries unread

write

public void write(byte[] data)
           throws IOException
write a block of data into the Container

Parameters:
data -
Throws:
IOException

read

public byte[] read()
            throws IOException
read a block of data from the container

Returns:
next data entry to read
Throws:
IOException

close

public void close()
           throws IOException
close the DataContainer and corresponding FileDataBlocks

Throws:
IOException


Copyright © 2004 Protique, Ltd.. All Rights Reserved.