appl.parallel.data.xulugridfile
Class BufferedHelper

java.lang.Object
  extended by appl.parallel.data.xulugridfile.BufferedHelper

public class BufferedHelper
extends Object

The methods of this class can be used to efficiently read or write values into a Bytestream (it is e.g. used by the XuluGridFile).

Author:
Dominik Appl

Constructor Summary
BufferedHelper()
           
 
Method Summary
static int readIntFromStream(ByteArrayInputStream input)
          Reads a long value out of the given bytestream Used for buffered reading.
static long readLongFromStream(ByteArrayInputStream input)
          Reads a long value out of the given ByteArrayInputStream.
static void writeInt(int v, ByteArrayOutputStream output)
          Writes a int value in the the given bytestream Used for buffered writing.
static void writeLong(long v, ByteArrayOutputStream output)
          Writes a long to the stream as eight bytes, high byte first.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BufferedHelper

public BufferedHelper()
Method Detail

readIntFromStream

public static final int readIntFromStream(ByteArrayInputStream input)
                                   throws IOException
Reads a long value out of the given bytestream Used for buffered reading. Used the code of RandomAccessFile.readInt()

Throws:
IOException - if an I/O error occurs.

writeInt

public static final void writeInt(int v,
                                  ByteArrayOutputStream output)
                           throws IOException
Writes a int value in the the given bytestream Used for buffered writing. Used the code of RandomAccessFile.writeInt(int)

Throws:
IOException - if an I/O error occurs.

writeLong

public static final void writeLong(long v,
                                   ByteArrayOutputStream output)
                            throws IOException
Writes a long to the stream as eight bytes, high byte first. The write starts at the current position of the file pointer. Used for buffered writing. Used the code of RandomAccessFile.writeLong(long)

Parameters:
output - the stream to be written to
v - a long to be written.
Throws:
IOException - if an I/O error occurs.

readLongFromStream

public static final long readLongFromStream(ByteArrayInputStream input)
                                     throws IOException
Reads a long value out of the given ByteArrayInputStream. Used for buffered reading. Used the code of RandomAccessFile.readLong() *

Throws:
IOException - if an I/O error occurs.