DataOutputByteBuffer (apache-cassandra API)
Date: 2014-10-21

org.apache.cassandra.io.util

## Class DataOutputByteBuffer

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.cassandra.io.util.AbstractDataOutput
    - - org.apache.cassandra.io.util.DataOutputByteBuffer

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

      public final class DataOutputByteBuffer
      extends AbstractDataOutput

  An implementation of the DataOutputStream interface using a FastByteArrayOutputStream and exposing its buffer so copies can be avoided. This class is completely thread unsafe.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DataOutputByteBuffer(java.nio.ByteBuffer buffer)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `write(byte[] b, int off, int len)` Writes `count` bytes from the byte array `buffer` starting at `offset` to this RandomAccessFile starting at the current file pointer..
    `void` | `write(java.nio.ByteBuffer buffer)`
    `void` | `write(int b)` Writes the specified byte `oneByte` to this RandomAccessFile starting at the current file pointer.

    - ### Methods inherited from class org.apache.cassandra.io.util.AbstractDataOutput

      `write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF`

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

      `close, flush`

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

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

- - ### Constructor Detail

    - #### DataOutputByteBuffer

          public DataOutputByteBuffer(java.nio.ByteBuffer buffer)

  - ### Method Detail

    - #### write

          public void write(int b)

      Description copied from class: `AbstractDataOutput`
      Writes the specified byte `oneByte` to this RandomAccessFile starting at the current file pointer. Only the low order byte of `oneByte` is written.
      Specified by:
        `write` in interface `java.io.DataOutput`
      Specified by:
        `write` in class `AbstractDataOutput`
      Parameters:
        `b` - the byte to be written

    - #### write

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

      Description copied from class: `AbstractDataOutput`
      Writes `count` bytes from the byte array `buffer` starting at `offset` to this RandomAccessFile starting at the current file pointer..
      Specified by:
        `write` in interface `java.io.DataOutput`
      Specified by:
        `write` in class `AbstractDataOutput`
      Parameters:
        `b` - the bytes to be written
        `off` - offset in buffer to get bytes
        `len` - number of bytes in buffer to write

    - #### write

          public void write(java.nio.ByteBuffer buffer)
                     throws java.io.IOException

      Specified by:
        `write` in interface `DataOutputPlus`
      Overrides:
        `write` in class `AbstractDataOutput`
      Throws:
        `java.io.IOException`

Copyright © 2014 The Apache Software Foundation