org.egothor.io
Class MemoryOutputStream

java.lang.Object
  extended by org.egothor.io.DataOutputStream
      extended by org.egothor.io.MemoryOutputStream
All Implemented Interfaces:
DataOutput

public class MemoryOutputStream
extends DataOutputStream

This class is part of the Egothor Project

Author:
Leo Galambos

Constructor Summary
MemoryOutputStream(int size, int delta)
          Constructor for the MemoryOutputStream object
 
Method Summary
 void copyFrom(DataInput in, int length)
          Copies bytes of a given length from input stream.
 void flush()
           
 byte[] getBytes()
           
 MemoryInputStream open()
           
 void reset()
          Description of the Method
 void write(byte[] buf, int offset, int len)
          Description of the Method
 void writeByte(int val)
          Description of the Method
static void writeInt(byte[] wr_buff, int i, int val)
          Writes the integer value as little-endian in the array from the offset.
static void writeLong(byte[] wr_buff, int i, long val)
          Writes the long-int value as little-endian in the array from the offset.
 void writeTo(DataOutput dos)
          Description of the Method
 long written()
          Description of the Method
 
Methods inherited from class org.egothor.io.DataOutputStream
close, copyFrom, printUTFS, writeBoolean, writeFully, writeInt, writeLong, writePack7, writePack7I, writeShort, writeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryOutputStream

public MemoryOutputStream(int size,
                          int delta)
Constructor for the MemoryOutputStream object

Parameters:
size - Description of the Parameter
delta - Description of the Parameter
Method Detail

open

public MemoryInputStream open()

copyFrom

public void copyFrom(DataInput in,
                     int length)
              throws java.io.IOException
Description copied from interface: DataOutput
Copies bytes of a given length from input stream. If the length is lower than zero, then the full input stream (til EOF) is copied.

Specified by:
copyFrom in interface DataOutput
Overrides:
copyFrom in class DataOutputStream
Throws:
java.io.IOException

written

public final long written()
Description of the Method

Specified by:
written in interface DataOutput
Specified by:
written in class DataOutputStream
Returns:
Description of the Return Value

writeByte

public void writeByte(int val)
               throws java.io.IOException
Description of the Method

Specified by:
writeByte in interface DataOutput
Specified by:
writeByte in class DataOutputStream
Parameters:
val - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

write

public void write(byte[] buf,
                  int offset,
                  int len)
           throws java.io.IOException
Description of the Method

Specified by:
write in interface DataOutput
Specified by:
write in class DataOutputStream
Parameters:
buf - Description of the Parameter
offset - Description of the Parameter
len - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

writeTo

public void writeTo(DataOutput dos)
             throws java.io.IOException
Description of the Method

Parameters:
dos - Description of the Parameter
Throws:
java.io.IOException - Description of the Exception

reset

public void reset()
Description of the Method


getBytes

public byte[] getBytes()

flush

public void flush()
           throws java.io.IOException
Specified by:
flush in class DataOutputStream
Throws:
java.io.IOException

writeLong

public static void writeLong(byte[] wr_buff,
                             int i,
                             long val)
Writes the long-int value as little-endian in the array from the offset.


writeInt

public static void writeInt(byte[] wr_buff,
                            int i,
                            int val)
Writes the integer value as little-endian in the array from the offset.