head 1.1; branch 1.1.1; access ; symbols DEVEL:1.1.1.1 HEAD:1.1.1; locks ; strict; comment @# @; 1.1 date 2001.03.16.18.13.13; author jallali; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2001.03.16.18.13.13; author jallali; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @

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

## java.io
Class ByteArrayOutputStream

    java.lang.Object
      |
      +--java.io.OutputStream
            |
            +--java.io.ByteArrayOutputStream

public class ByteArrayOutputStream
extends OutputStream

ByteArrayOutputStream is a class whose underlying stream is represented by a byte array. As bytes are written to this stream, the local byte array may be expanded to hold more bytes.

See Also:
  `ByteArrayInputStream`

Field Summary
`protected byte[]` | `buf` The byte array containing the bytes written.
`protected int` | `count` The number of bytes written.

Constructor Summary
`ByteArrayOutputStream()` Constructs a new ByteArrayOutputStream with a default size of 32 bytes.
`ByteArrayOutputStream(int size)` Constructs a new ByteArrayOutputStream with a default size of `size` bytes.

Method Summary
`void` | `reset()` Reset this ByteArrayOutputStream to the beginning of the underlying byte array.
`int` | `size()` Answers the total number of bytes written to this stream thus far.
`byte[]` | `toByteArray()` Answer the contents of this ByteArrayOutputStream as a byte array.
`void` | `write(byte[] buffer, int offset, int count)` Writes `count` `bytes` from the byte array `buffer` starting at offset `index` to the ByteArrayOutputStream.
`void` | `write(int oneByte)` Writes the specified byte `oneByte` to the OutputStream.

Methods inherited from class java.io.OutputStream
`close, flush, write`

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

Field Detail

### buf

    protected byte[] buf

  The byte array containing the bytes written.

### count

    protected int count

  The number of bytes written.

Constructor Detail

### ByteArrayOutputStream

    public ByteArrayOutputStream()

  Constructs a new ByteArrayOutputStream with a default size of 32 bytes. If more than 32 bytes are written to this instance, the underlying byte array will expand to accomodate.

### ByteArrayOutputStream

    public ByteArrayOutputStream(int size)

  Constructs a new ByteArrayOutputStream with a default size of `size` bytes. If more than `size` bytes are written to this instance, the underlying byte array will expand to accomodate.
  Parameters:
    `size` - an non-negative integer representing the initial size for the underlying byte array.

Method Detail

### reset

    public void reset()

  Reset this ByteArrayOutputStream to the beginning of the underlying byte array. All subsequent writes will overwrite any bytes previously stored in this stream.

### size

    public int size()

  Answers the total number of bytes written to this stream thus far.
  Returns:
    the number of bytes written to this Stream.

### toByteArray

    public byte[] toByteArray()

  Answer the contents of this ByteArrayOutputStream as a byte array. Any changes made to the receiver after returning will not be reflected in the byte array returned to the caller.
  Returns:
    this streams current contents as a byte array.

### write

    public void write(byte[] buffer,
                      int offset,
                      int count)

  Writes `count` `bytes` from the byte array `buffer` starting at offset `index` to the ByteArrayOutputStream.
  Overrides:
    write in class OutputStream
  Parameters:
    `buffer` - the buffer to be written
    `offset` - offset in buffer to get bytes
    `count` - number of bytes in buffer to write
  Throws:
    NullPointerException - If buffer is null.
    IndexOutOfBoundsException - If offset or count are outside of bounds.

### write

    public void write(int oneByte)

  Writes the specified byte `oneByte` to the OutputStream. Only the low order byte of `oneByte` is written.
  Overrides:
    write in class OutputStream
  Parameters:
    `oneByte` - the byte to be written

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

@ 1.1.1.1 log @import initial @ text @@