Class wb.BytePackOutputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class wb.BytePackOutputStream

java.lang.Object
   |
   +----wb.BytePackOutputStream

public class BytePackOutputStream
extends Object
This class lets you write primitive Java data types to a byte array in a portable way. Primitive data types are well understood types with associated operations. For example, an Integer is considered to be a good primitive data type. The data can be converted back using a ByteUnPackInputStream.

Variable Index

 o buf
The buffer where data is stored.
 o count
The number of bytes in the buffer.
 o outstream
The real stream onto which the byte array will be written

Constructor Index

 o BytePackOutputStream(OutputStream)
Creates a new BytePackOutputStream.

Method Index

 o size()
Returns the current size of the local buffer which would be written when sync'd
 o sync()
Writes a byte buffer to the stream that was specified during instantiation.
 o sync(OutputStream)
Writes a byte buffer to the specified stream.
 o writeBoolean(boolean)
Writes a boolean.
 o writeByte(int)
Writes an 8 bit byte.
 o writeBytes(String)
Writes a String as a sequence of bytes.
 o writeChar(int)
Writes a 16 bit char.
 o writeChars(String)
Writes a String as a sequence of chars.
 o writeDouble(double)
Writes a 64 bit double.
 o writeFloat(float)
Writes a 32 bit float.
 o writeInt(int)
Writes a 32 bit int.
 o writeLong(long)
Writes a 64 bit long.
 o writeShort(int)
Writes a 16 bit short.

Variables

 o buf
  protected byte buf[]
The buffer where data is stored.
 o count
  protected int count
The number of bytes in the buffer.
 o outstream
  protected OutputStream outstream
The real stream onto which the byte array will be written

Constructors

 o BytePackOutputStream
  public BytePackOutputStream(OutputStream out)
Creates a new BytePackOutputStream.
Parameters:
out - the output stream

Methods

 o sync
  public synchronized void sync() throws IOException
Writes a byte buffer to the stream that was specified during instantiation.
 o sync
  public synchronized void sync(OutputStream out) throws IOException
Writes a byte buffer to the specified stream.
Parameters:
out - OutputStream to which the byte array is written. the internal buffer is uneffected.
 o writeBoolean
  public synchronized void writeBoolean(boolean v)
Writes a boolean.
Parameters:
v - the boolean to be written
 o writeByte
  public synchronized void writeByte(int v)
Writes an 8 bit byte.
Parameters:
v - the byte value to be written
 o writeShort
  public synchronized void writeShort(int v)
Writes a 16 bit short.
Parameters:
v - the short value to be written
 o writeChar
  public synchronized void writeChar(int v)
Writes a 16 bit char.
Parameters:
v - the char value to be written
 o writeInt
  public synchronized void writeInt(int v)
Writes a 32 bit int.
Parameters:
v - the integer value to be written
 o writeLong
  public synchronized void writeLong(long v)
Writes a 64 bit long.
Parameters:
v - the long value to be written
 o writeFloat
  public synchronized void writeFloat(float v)
Writes a 32 bit float.
Parameters:
v - the float value to be written
 o writeDouble
  public synchronized void writeDouble(double v)
Writes a 64 bit double.
Parameters:
v - the double value to be written
 o writeBytes
  public synchronized void writeBytes(String s)
Writes a String as a sequence of bytes.
Parameters:
s - the String of bytes to be written
 o writeChars
  public synchronized void writeChars(String s)
Writes a String as a sequence of chars.
Parameters:
s - the String of chars to be written
 o size
  public int size()
Returns the current size of the local buffer which would be written when sync'd

All Packages  Class Hierarchy  This Package  Previous  Next  Index