waba.io
Class ByteArrayOutputStream

java.lang.Object
  |
  +--waba.io.Stream
        |
        +--waba.io.ByteArrayOutputStream

public class ByteArrayOutputStream
extends Stream

creates a byte array output stream. it can be useful with the method Catalog.inspectRecord, since that method returns a byte array. added by guich.


Field Summary
protected  byte[] buffer
           
protected  int pos
           
 
Constructor Summary
ByteArrayOutputStream(byte[] buffer)
          sets the internal buffer to be the specified buffer param
ByteArrayOutputStream(int size)
          creates a new buffer with the specific size
 
Method Summary
 boolean close()
          does nothing
 byte[] getBuffer()
          gets the buffer used
 int readBytes(byte[] buf, int start, int count)
          transfers count bytes from class buffer to buf.
 void reset()
          resets the position to 0 so the buffer can be reused.
 int writeBytes(byte[] buf, int start, int count)
          does nothing
 
Methods inherited from class java.lang.Object
hashCode, toString
 

Field Detail

pos

protected int pos

buffer

protected byte[] buffer
Constructor Detail

ByteArrayOutputStream

public ByteArrayOutputStream(byte[] buffer)
sets the internal buffer to be the specified buffer param

ByteArrayOutputStream

public ByteArrayOutputStream(int size)
creates a new buffer with the specific size
Method Detail

reset

public void reset()
resets the position to 0 so the buffer can be reused.

getBuffer

public byte[] getBuffer()
gets the buffer used

readBytes

public int readBytes(byte[] buf,
                     int start,
                     int count)
transfers count bytes from class buffer to buf. Does not perform range checking!
Overrides:
readBytes in class Stream
Returns:
the number of bytes readen.

writeBytes

public int writeBytes(byte[] buf,
                      int start,
                      int count)
does nothing
Overrides:
writeBytes in class Stream
Tags copied from class: Stream
Parameters:
buf - the byte array to write data from
start - the start position in the byte array
count - the number of bytes to write

close

public boolean close()
does nothing
Overrides:
close in class Stream