Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.message.util
Class DataContainer

    java.lang.Object
      org.codehaus.activemq.message.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 $

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
`(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(java.io.File dir,
                  java.lang.String name,
                  int maxBlockSize)
            throws java.io.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:
  `java.io.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 java.io.IOException

  write a block of data into the Container

  Parameters:
    `data` -
  Throws:
    `java.io.IOException`

### read

    public byte[] read()
                throws java.io.IOException

  read a block of data from the container

  Returns:
    next data entry to read
  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  close the DataContainer and corresponding FileDataBlocks

  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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