org.codehaus.activemq.message.util
Class FileDataBlock

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

class FileDataBlock
extends Object

Simply writes/reads data from a RandomAccessFile

Version:
$Revision: 1.1 $

Constructor Summary
(package private) FileDataBlock(File file, long maxSize)
          Constructor
 
Method Summary
(package private)  void close()
          close and deletes the block
(package private)  boolean isEnoughSpace(byte[] data)
          test to if there is enough room in the block to write the data
(package private)  byte[] read()
          read next chunk of data
(package private)  void write(byte[] data)
          Write data to the end of the block
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDataBlock

FileDataBlock(File file,
              long maxSize)
        throws IOException
Constructor

Parameters:
file - File handle
maxSize - maximum size (in bytes) for the block
Throws:
IOException
Method Detail

close

void close()
     throws IOException
close and deletes the block

Throws:
IOException

isEnoughSpace

boolean isEnoughSpace(byte[] data)
                throws IOException
test to if there is enough room in the block to write the data

Parameters:
data - bytes to be written
Returns:
true if there is enough space left in the block to write the data
Throws:
IOException

write

void write(byte[] data)
     throws IOException
Write data to the end of the block

Parameters:
data - the bytes to write
Throws:
IOException

read

byte[] read()
      throws IOException
read next chunk of data

Returns:
next chunk of data or null if no more to read
Throws:
IOException


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