Module org.hsqldb
Package org.hsqldb.lib

## Class HsqlByteArrayOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.hsqldb.lib.HsqlByteArrayOutputStream

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

      public class HsqlByteArrayOutputStream
      extends java.io.OutputStream
      implements java.io.DataOutput

  This class is a replacement for both java.io.ByteArrayOuputStream (without synchronization) and java.io.DataOutputStream
  Since:
    1.7.0
  Author:
    Fred Toussi (fredt@users dot sourceforge.net)

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HsqlByteArrayOutputStream()` |
    `HsqlByteArrayOutputStream​(byte[] buffer)` |
    `HsqlByteArrayOutputStream​(int size)` |
    `HsqlByteArrayOutputStream​(java.io.InputStream input)` |
    `HsqlByteArrayOutputStream​(java.io.InputStream input, int length)` | Constructor from an InputStream limits size to the length argument.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `void` | `ensureRoom​(int extra)` |
    `void` | `fill​(int b, int len)` |
    `void` | `flush()` | does nothing
    `byte[]` | `getBuffer()` |
    `void` | `reset()` |
    `void` | `reset​(byte[] buffer)` |
    `void` | `reset​(int newSize)` |
    `void` | `setPosition​(int newPos)` |
    `void` | `setSize​(int size)` | size must fit in buffer
    `int` | `size()` |
    `byte[]` | `toByteArray()` |
    `java.lang.String` | `toString()` |
    `java.lang.String` | `toString​(java.lang.String enc)` |
    `void` | `write​(byte[] b)` |
    `void` | `write​(byte[] b, int off, int len)` |
    `void` | `write​(char[] c, int off, int len)` |
    `void` | `write​(int b)` |
    `int` | `write​(java.io.InputStream input, int countLimit)` |
    `int` | `write​(java.io.Reader input, int countLimit)` |
    `void` | `writeBoolean​(boolean v)` |
    `void` | `writeByte​(int v)` |
    `void` | `writeBytes​(java.lang.String s)` |
    `void` | `writeChar​(int v)` |
    `void` | `writeChars​(char[] charArray)` |
    `void` | `writeChars​(java.lang.String s)` |
    `void` | `writeDouble​(double v)` |
    `void` | `writeFloat​(float v)` |
    `void` | `writeInt​(int v)` |
    `void` | `writeLong​(long v)` |
    `void` | `writeNoCheck​(int b)` |
    `void` | `writeShort​(int v)` |
    `void` | `writeTo​(java.io.OutputStream out)` |
    `void` | `writeUTF​(java.lang.String str)` |

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

      `nullOutputStream`

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

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

- - ### Constructor Detail

    - #### HsqlByteArrayOutputStream

          public HsqlByteArrayOutputStream()

    - #### HsqlByteArrayOutputStream

          public HsqlByteArrayOutputStream​(int size)

    - #### HsqlByteArrayOutputStream

          public HsqlByteArrayOutputStream​(byte[] buffer)

    - #### HsqlByteArrayOutputStream

          public HsqlByteArrayOutputStream​(java.io.InputStream input,
                                           int length)
                                    throws java.io.IOException

      Constructor from an InputStream limits size to the length argument. Throws if the actual length of the InputStream is smaller than length value.
      Parameters:
        `input` - InputStream
        `length` - int
      Throws:
        `java.io.IOException` - if an error occurs

    - #### HsqlByteArrayOutputStream

          public HsqlByteArrayOutputStream​(java.io.InputStream input)
                                    throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### writeShort

          public void writeShort​(int v)

      Specified by:
        `writeShort` in interface `java.io.DataOutput`

    - #### writeInt

          public void writeInt​(int v)

      Specified by:
        `writeInt` in interface `java.io.DataOutput`

    - #### writeLong

          public void writeLong​(long v)

      Specified by:
        `writeLong` in interface `java.io.DataOutput`

    - #### writeBytes

          public void writeBytes​(java.lang.String s)

      Specified by:
        `writeBytes` in interface `java.io.DataOutput`

    - #### writeFloat

          public final void writeFloat​(float v)

      Specified by:
        `writeFloat` in interface `java.io.DataOutput`

    - #### writeDouble

          public final void writeDouble​(double v)

      Specified by:
        `writeDouble` in interface `java.io.DataOutput`

    - #### writeBoolean

          public void writeBoolean​(boolean v)

      Specified by:
        `writeBoolean` in interface `java.io.DataOutput`

    - #### writeByte

          public void writeByte​(int v)

      Specified by:
        `writeByte` in interface `java.io.DataOutput`

    - #### writeChar

          public void writeChar​(int v)

      Specified by:
        `writeChar` in interface `java.io.DataOutput`

    - #### writeChars

          public void writeChars​(java.lang.String s)

      Specified by:
        `writeChars` in interface `java.io.DataOutput`

    - #### writeUTF

          public void writeUTF​(java.lang.String str)
                        throws java.io.IOException

      Specified by:
        `writeUTF` in interface `java.io.DataOutput`
      Throws:
        `java.io.IOException`

    - #### flush

          public void flush()

      does nothing
      Specified by:
        `flush` in interface `java.io.Flushable`
      Overrides:
        `flush` in class `java.io.OutputStream`

    - #### write

          public void write​(int b)

      Specified by:
        `write` in interface `java.io.DataOutput`
      Specified by:
        `write` in class `java.io.OutputStream`

    - #### write

          public void write​(byte[] b)

      Specified by:
        `write` in interface `java.io.DataOutput`
      Overrides:
        `write` in class `java.io.OutputStream`

    - #### write

          public void write​(byte[] b,
                            int off,
                            int len)

      Specified by:
        `write` in interface `java.io.DataOutput`
      Overrides:
        `write` in class `java.io.OutputStream`

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### close

          public void close()

      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Specified by:
        `close` in interface `java.io.Closeable`
      Overrides:
        `close` in class `java.io.OutputStream`

    - #### writeNoCheck

          public void writeNoCheck​(int b)

    - #### writeChars

          public void writeChars​(char[] charArray)

    - #### write

          public int write​(java.io.InputStream input,
                           int countLimit)
                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### write

          public int write​(java.io.Reader input,
                           int countLimit)
                    throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### writeTo

          public void writeTo​(java.io.OutputStream out)
                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### reset

          public void reset()

    - #### toByteArray

          public byte[] toByteArray()

    - #### size

          public final int size()

    - #### setPosition

          public void setPosition​(int newPos)

    - #### toString

          public java.lang.String toString​(java.lang.String enc)
                                    throws java.io.UnsupportedEncodingException

      Throws:
        `java.io.UnsupportedEncodingException`

    - #### write

          public void write​(char[] c,
                            int off,
                            int len)

    - #### fill

          public void fill​(int b,
                           int len)

    - #### getBuffer

          public byte[] getBuffer()

    - #### ensureRoom

          public void ensureRoom​(int extra)

    - #### reset

          public void reset​(int newSize)

    - #### reset

          public void reset​(byte[] buffer)

    - #### setSize

          public void setSize​(int size)

      size must fit in buffer
      Parameters:
        `size` - int