OutputBuffer
Date: 2015-03-03

org.bson.io

## Class OutputBuffer

- java.lang.Object
- - java.io.OutputStream
  - - org.bson.io.OutputBuffer

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
  Direct Known Subclasses:
    BasicOutputBuffer, PoolOutputBuffer

      public abstract class OutputBuffer
      extends java.io.OutputStream

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `OutputBuffer()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `asString()`
    `java.lang.String` | `asString(java.lang.String encoding)`
    `abstract int` | `getPosition()`
    `java.lang.String` | `hex()`
    `java.lang.String` | `md5()`
    `abstract int` | `pipe(java.io.OutputStream out)`
    `abstract void` | `seekEnd()`
    `abstract void` | `seekStart()`
    `abstract void` | `setPosition(int position)`
    `abstract int` | `size()`
    `byte[]` | `toByteArray()` mostly for testing
    `java.lang.String` | `toString()`
    `abstract void` | `write(byte[] b)`
    `abstract void` | `write(byte[] b, int off, int len)`
    `abstract void` | `write(int b)`
    `void` | `writeDouble(double x)`
    `void` | `writeInt(int x)`
    `void` | `writeInt(int pos, int x)`
    `void` | `writeIntBE(int x)`
    `void` | `writeLong(long x)`

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

      `close, flush`

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

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

- - ### Constructor Detail

    - #### OutputBuffer

          public OutputBuffer()

  - ### Method Detail

    - #### write

          public abstract void write(byte[] b)

      Overrides:
        `write` in class `java.io.OutputStream`

    - #### write

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

      Overrides:
        `write` in class `java.io.OutputStream`

    - #### write

          public abstract void write(int b)

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

    - #### getPosition

          public abstract int getPosition()

    - #### setPosition

          public abstract void setPosition(int position)

    - #### seekEnd

          public abstract void seekEnd()

    - #### seekStart

          public abstract void seekStart()

    - #### size

          public abstract int size()

      Returns:
        size of data so far

    - #### pipe

          public abstract int pipe(java.io.OutputStream out)
                            throws java.io.IOException

      Returns:
        bytes written
      Throws:
        `java.io.IOException`

    - #### toByteArray

          public byte[] toByteArray()

      mostly for testing

    - #### asString

          public java.lang.String asString()

    - #### asString

          public java.lang.String asString(java.lang.String encoding)
                                    throws java.io.UnsupportedEncodingException

      Throws:
        `java.io.UnsupportedEncodingException`

    - #### hex

          public java.lang.String hex()

    - #### md5

          public java.lang.String md5()

    - #### writeInt

          public void writeInt(int x)

    - #### writeIntBE

          public void writeIntBE(int x)

    - #### writeInt

          public void writeInt(int pos,
                      int x)

    - #### writeLong

          public void writeLong(long x)

    - #### writeDouble

          public void writeDouble(double x)

    - #### toString

          public java.lang.String toString()

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