Buffer (Apache Hadoop Main 3.5.0 API)
Description: declaration: package: org.apache.hadoop.record, class: Buffer

Package org.apache.hadoop.record

# Class Buffer

java.lang.Object
org.apache.hadoop.record.Buffer

All Implemented Interfaces:
  `Cloneable`, `Comparable`

@Deprecated @Public @Stable public class Buffer extends Object implements Comparable, Cloneable
Deprecated.
Replaced by Avro.
A byte sequence that is used as a Java native type for buffer. It is resizable and distinguishes between the count of the sequence and the current capacity.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Buffer()`
  Deprecated.
  Create a zero-count sequence.
  `Buffer(byte[] bytes)`
  Deprecated.
  Create a Buffer using the byte array as the initial value.
  `Buffer(byte[] bytes, int offset, int length)`
  Deprecated.
  Create a Buffer using the byte range as the initial value.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `append(byte[] bytes)`
  Deprecated.
  Append specified bytes to the buffer
  `void`
  `append(byte[] bytes, int offset, int length)`
  Deprecated.
  Append specified bytes to the buffer.
  `Object`
  `clone()`
  Deprecated.
  `int`
  `compareTo(Object other)`
  Deprecated.
  Define the sort order of the Buffer.
  `final void`
  `copy(byte[] bytes, int offset, int length)`
  Deprecated.
  Copy the specified byte array to the Buffer.
  `boolean`
  `equals(Object other)`
  Deprecated.
  `byte[]`
  `get()`
  Deprecated.
  Get the data from the Buffer.
  `int`
  `getCapacity()`
  Deprecated.
  Get the capacity, which is the maximum count that could handled without resizing the backing storage.
  `int`
  `getCount()`
  Deprecated.
  Get the current count of the buffer.
  `int`
  `hashCode()`
  Deprecated.
  `void`
  `reset()`
  Deprecated.
  Reset the buffer to 0 size
  `void`
  `set(byte[] bytes)`
  Deprecated.
  Use the specified bytes array as underlying sequence.
  `void`
  `setCapacity(int newCapacity)`
  Deprecated.
  Change the capacity of the backing storage.
  `String`
  `toString()`
  Deprecated.
  `String`
  `toString(String charsetName)`
  Deprecated.
  Convert the byte buffer to a string an specific character encoding
  `void`
  `truncate()`
  Deprecated.
  Change the capacity of the backing store to be the same as the current count of buffer.

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

  `finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Buffer

    public Buffer()
    Deprecated.
    Create a zero-count sequence.

  - ### Buffer

    public Buffer(byte[] bytes)
    Deprecated.
    Create a Buffer using the byte array as the initial value.
    Parameters:
      `bytes` - This array becomes the backing storage for the object.

  - ### Buffer

    public Buffer(byte[] bytes, int offset, int length)
    Deprecated.
    Create a Buffer using the byte range as the initial value.
    Parameters:
      `bytes` - Copy of this array becomes the backing storage for the object.
      `offset` - offset into byte array
      `length` - length of data

- ## Method Details

  - ### set

    public void set(byte[] bytes)
    Deprecated.
    Use the specified bytes array as underlying sequence.
    Parameters:
      `bytes` - byte sequence

  - ### copy

    public final void copy(byte[] bytes, int offset, int length)
    Deprecated.
    Copy the specified byte array to the Buffer. Replaces the current buffer.
    Parameters:
      `bytes` - byte array to be assigned
      `offset` - offset into byte array
      `length` - length of data

  - ### get

    public byte[] get()
    Deprecated.
    Get the data from the Buffer.
    Returns:
      The data is only valid between 0 and getCount() - 1.

  - ### getCount

    public int getCount()
    Deprecated.
    Get the current count of the buffer.

  - ### getCapacity

    public int getCapacity()
    Deprecated.
    Get the capacity, which is the maximum count that could handled without resizing the backing storage.
    Returns:
      The number of bytes

  - ### setCapacity

    public void setCapacity(int newCapacity)
    Deprecated.
    Change the capacity of the backing storage. The data is preserved if newCapacity >= getCount().
    Parameters:
      `newCapacity` - The new capacity in bytes.

  - ### reset

    public void reset()
    Deprecated.
    Reset the buffer to 0 size

  - ### truncate

    public void truncate()
    Deprecated.
    Change the capacity of the backing store to be the same as the current count of buffer.

  - ### append

    public void append(byte[] bytes, int offset, int length)
    Deprecated.
    Append specified bytes to the buffer.
    Parameters:
      `bytes` - byte array to be appended
      `offset` - offset into byte array
      `length` - length of data

  - ### append

    public void append(byte[] bytes)
    Deprecated.
    Append specified bytes to the buffer
    Parameters:
      `bytes` - byte array to be appended

  - ### hashCode

    public int hashCode()
    Deprecated.
    Overrides:
      `hashCode` in class `Object`

  - ### compareTo

    public int compareTo(Object other)
    Deprecated.
    Define the sort order of the Buffer.
    Specified by:
      `compareTo` in interface `Comparable`
    Parameters:
      `other` - The other buffer
    Returns:
      Positive if this is bigger than other, 0 if they are equal, and negative if this is smaller than other.

  - ### equals

    public boolean equals(Object other)
    Deprecated.
    Overrides:
      `equals` in class `Object`

  - ### toString

    public String toString()
    Deprecated.
    Overrides:
      `toString` in class `Object`

  - ### toString

    public String toString(String charsetName) throws UnsupportedEncodingException
    Deprecated.
    Convert the byte buffer to a string an specific character encoding
    Parameters:
      `charsetName` - Valid Java Character Set Name
    Throws:
      `UnsupportedEncodingException`

  - ### clone

    public Object clone() throws CloneNotSupportedException
    Deprecated.
    Overrides:
      `clone` in class `Object`
    Throws:
      `CloneNotSupportedException`