de.vc.io

## Class ByteArrayBuffer

- java.lang.Object
- - java.io.OutputStream
  - - java.io.ByteArrayOutputStream
    - - de.vc.io.ByteArrayBuffer

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

      public class ByteArrayBuffer
      extends java.io.ByteArrayOutputStream

  Buffer based on ByteArrayOutputStream.
  Usage:
  - Fill the buffer using the write methodes.
  - Read content of buffer through InputStream created by methode inputStream()
  - Clear content of buffer with reset()

- - ### Field Summary

    - ### Fields inherited from class java.io.ByteArrayOutputStream

      `buf, count`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ByteArrayBuffer()` Constructs a new buffer.
    `ByteArrayBuffer(int size)` Constructs a new buffer with initial buffer size.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `byte[]` | `getBuffer()` Gets the buffer.
    `java.io.InputStream` | `inputStream()` Creates an input stream reading from buffer.
    `boolean` | `isFull()`

    - ### Methods inherited from class java.io.ByteArrayOutputStream

      `close, reset, size, toByteArray, toString, toString, toString, write, write, writeTo`

    - ### Methods inherited from class java.io.OutputStream

      `flush, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ByteArrayBuffer

          public ByteArrayBuffer()

      Constructs a new buffer.

    - #### ByteArrayBuffer

          public ByteArrayBuffer(int size)

      Constructs a new buffer with initial buffer size.
      Parameters:
        `size` - Initial size of buffer.

  - ### Method Detail

    - #### isFull

          public boolean isFull()

    - #### getBuffer

          public byte[] getBuffer()

      Gets the buffer. Note the buffer may be not full filled or empty. Use size() to determinate length.
      Returns:
        Bytes of buffer.

    - #### inputStream

          public java.io.InputStream inputStream()

      Creates an input stream reading from buffer. This input stream does not modify buffer.
      Returns:
        Input stream.

© 2003-2011 by Sascha Schmidt (vision-cloud.de). All Rights Reserved.