Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## waba.io
Class ByteArrayStream

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

public final class ByteArrayStream
extends Stream

creates a byte array stream. it can be useful with the method Catalog.inspectRecord, since that method returns a byte array. When writting, the buffer expands itself if needed. This class cannot be used for output AND input, but only for output OR input.

Constructor Summary
`ByteArrayStream(byte[] buffer)` sets the internal buffer to be the specified buffer param.
`ByteArrayStream(int size)` creates a new buffer with the specific size.

Method Summary
`boolean` | `close()` does nothing.
`int` | `count()` returns the current position in the buffer.
`byte[]` | `getBuffer()` gets the buffer used. the size of the buffer may be different of the array length. get its size in count().
`boolean` | `isOpen()` Returns true if this Stream is open and false otherwise
`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)` this writes to the byte array, expanding it if necessary. returns the number of bytes written.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, toString, wait, wait`

Constructor Detail

### ByteArrayStream

    public ByteArrayStream(byte[] buffer)

  sets the internal buffer to be the specified buffer param.

### ByteArrayStream

    public ByteArrayStream(int size)

  creates a new buffer with the specific size. CANNOT BE 0!

Method Detail

### close

    public boolean close()

  does nothing.
  Overrides:
    close in class Stream

### getBuffer

    public byte[] getBuffer()

  gets the buffer used. the size of the buffer may be different of the array length. get its size in count().

### count

    public int count()

  returns the current position in the buffer.

### 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.

### reset

    public void reset()

  resets the position to 0 so the buffer can be reused.

### writeBytes

    public int writeBytes(byte[] buf,
                          int start,
                          int count)

  this writes to the byte array, expanding it if necessary. returns the number of bytes written.
  Overrides:
    writeBytes in class Stream
  Since:
    SuperWaba2_0beta2

### isOpen

    public boolean isOpen()

  Description copied from class: Stream
  Returns true if this Stream is open and false otherwise
  Overrides:
    isOpen in class Stream

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD