Class Utils

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

@Deprecated @Public @Stable public class Utils extends Object
Deprecated.
Replaced by Avro.
Various utility functions for Hadoop record I/O runtime.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final char[]
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    compareBytes(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
    Deprecated.
    Lexicographic order of binary data.
    static int
    getVIntSize(long i)
    Deprecated.
    Get the encoded length if an integer is stored in a variable-length format
    static double
    readDouble(byte[] bytes, int start)
    Deprecated.
    Parse a double from a byte array.
    static float
    readFloat(byte[] bytes, int start)
    Deprecated.
    Parse a float from a byte array.
    static int
    readVInt(byte[] bytes, int start)
    Deprecated.
    Reads a zero-compressed encoded integer from a byte array and returns it.
    static int
    Deprecated.
    Reads a zero-compressed encoded integer from a stream and returns it.
    static long
    readVLong(byte[] bytes, int start)
    Deprecated.
    Reads a zero-compressed encoded long from a byte array and returns it.
    static long
    Deprecated.
    Reads a zero-compressed encoded long from a stream and return it.
    static void
    writeVInt(DataOutput stream, int i)
    Deprecated.
    Serializes an int to a binary stream with zero-compressed encoding.
    static void
    writeVLong(DataOutput stream, long i)
    Deprecated.
    Serializes a long to a binary stream with zero-compressed encoding.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • hexchars

      public static final char[] hexchars
      Deprecated.
  • Method Details

    • readFloat

      public static float readFloat(byte[] bytes, int start)
      Deprecated.
      Parse a float from a byte array.
    • readDouble

      public static double readDouble(byte[] bytes, int start)
      Deprecated.
      Parse a double from a byte array.
    • readVLong

      public static long readVLong(byte[] bytes, int start) throws IOException
      Deprecated.
      Reads a zero-compressed encoded long from a byte array and returns it.
      Parameters:
      bytes - byte array with decode long
      start - starting index
      Returns:
      deserialized long
      Throws:
      IOException
    • readVInt

      public static int readVInt(byte[] bytes, int start) throws IOException
      Deprecated.
      Reads a zero-compressed encoded integer from a byte array and returns it.
      Parameters:
      bytes - byte array with the encoded integer
      start - start index
      Returns:
      deserialized integer
      Throws:
      IOException
    • readVLong

      public static long readVLong(DataInput in) throws IOException
      Deprecated.
      Reads a zero-compressed encoded long from a stream and return it.
      Parameters:
      in - input stream
      Returns:
      deserialized long
      Throws:
      IOException
    • readVInt

      public static int readVInt(DataInput in) throws IOException
      Deprecated.
      Reads a zero-compressed encoded integer from a stream and returns it.
      Parameters:
      in - input stream
      Returns:
      deserialized integer
      Throws:
      IOException
    • getVIntSize

      public static int getVIntSize(long i)
      Deprecated.
      Get the encoded length if an integer is stored in a variable-length format
      Returns:
      the encoded length
    • writeVLong

      public static void writeVLong(DataOutput stream, long i) throws IOException
      Deprecated.
      Serializes a long to a binary stream with zero-compressed encoding. For -112 <= i <= 127, only one byte is used with the actual value. For other values of i, the first byte value indicates whether the long is positive or negative, and the number of bytes that follow. If the first byte value v is between -113 and -120, the following long is positive, with number of bytes that follow are -(v+112). If the first byte value v is between -121 and -128, the following long is negative, with number of bytes that follow are -(v+120). Bytes are stored in the high-non-zero-byte-first order.
      Parameters:
      stream - Binary output stream
      i - Long to be serialized
      Throws:
      IOException
    • writeVInt

      public static void writeVInt(DataOutput stream, int i) throws IOException
      Deprecated.
      Serializes an int to a binary stream with zero-compressed encoding.
      Parameters:
      stream - Binary output stream
      i - int to be serialized
      Throws:
      IOException
    • compareBytes

      public static int compareBytes(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
      Deprecated.
      Lexicographic order of binary data.