org.apache.cassandra.utils.vint

## Class EncodedDataOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.cassandra.io.util.DataOutputStreamPlus
    - - org.apache.cassandra.io.util.UnbufferedDataOutputStreamPlus
      - - org.apache.cassandra.utils.vint.EncodedDataOutputStream

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

      public class EncodedDataOutputStream
      extends UnbufferedDataOutputStreamPlus

  Borrows idea from https://developers.google.com/protocol-buffers/docs/encoding#varints

- - ### Field Summary

    - ### Fields inherited from class org.apache.cassandra.io.util.DataOutputStreamPlus

      `channel`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EncodedDataOutputStream(java.io.OutputStream out)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `write(byte[] b)` Writes the entire contents of the byte array `buffer` to this RandomAccessFile starting at the current file pointer.
    `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(int b)` Writes the specified byte `oneByte` to this RandomAccessFile starting at the current file pointer.
    `void` | `writeInt(int v)` Writes a 32-bit int to this output stream.
    `void` | `writeLong(long v)` Writes a 64-bit long to this output stream.
    `void` | `writeShort(int v)` Writes the specified 16-bit short to the OutputStream.

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

      `applyToChannel, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeUTF, writeUTF`

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

      `newDefaultChannel, retrieveTemporaryBuffer`

    - ### 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

    - #### EncodedDataOutputStream

          public EncodedDataOutputStream(java.io.OutputStream out)

  - ### Method Detail

    - #### write

          public void write(int b)
                     throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      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 `UnbufferedDataOutputStreamPlus`
      Parameters:
        `b` - the byte to be written
      Throws:
        `java.io.IOException` - If an error occurs attempting to write to this RandomAccessFile.

    - #### write

          public void write(byte[] b)
                     throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      Writes the entire contents of the byte array `buffer` to this RandomAccessFile starting at the current file pointer.
      Specified by:
        `write` in interface `java.io.DataOutput`
      Overrides:
        `write` in class `UnbufferedDataOutputStreamPlus`
      Parameters:
        `b` - the buffer to be written.
      Throws:
        `java.io.IOException` - If an error occurs trying to write to this RandomAccessFile.

    - #### write

          public void write(byte[] b,
                            int off,
                            int len)
                     throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      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 `UnbufferedDataOutputStreamPlus`
      Parameters:
        `b` - the bytes to be written
        `off` - offset in buffer to get bytes
        `len` - number of bytes in buffer to write
      Throws:
        `java.io.IOException` - If an error occurs attempting to write to this RandomAccessFile.

    - #### writeInt

          public void writeInt(int v)
                        throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      Writes a 32-bit int to this output stream. The resulting output is the 4 bytes, highest order first, of val.
      Specified by:
        `writeInt` in interface `java.io.DataOutput`
      Overrides:
        `writeInt` in class `UnbufferedDataOutputStreamPlus`
      Parameters:
        `v` - the int to be written.
      Throws:
        `java.io.IOException` - If an error occurs attempting to write to this DataOutputStream.

    - #### writeLong

          public void writeLong(long v)
                         throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      Writes a 64-bit long to this output stream. The resulting output is the 8 bytes, highest order first, of val.
      Specified by:
        `writeLong` in interface `java.io.DataOutput`
      Overrides:
        `writeLong` in class `UnbufferedDataOutputStreamPlus`
      Parameters:
        `v` - the long to be written.
      Throws:
        `java.io.IOException` - If an error occurs attempting to write to this DataOutputStream.

    - #### writeShort

          public void writeShort(int v)
                          throws java.io.IOException

      Description copied from class: `UnbufferedDataOutputStreamPlus`
      Writes the specified 16-bit short to the OutputStream. Only the lower 2 bytes are written with the higher of the 2 bytes written first.
      Specified by:
        `writeShort` in interface `java.io.DataOutput`
      Overrides:
        `writeShort` in class `UnbufferedDataOutputStreamPlus`
      Parameters:
        `v` - the short to be written
      Throws:
        `java.io.IOException` - If an error occurs attempting to write to this DataOutputStream.

Copyright © 2018 The Apache Software Foundation