public final class WritableUtils extends Object
Constructor and Description |
---|
WritableUtils() |
Modifier and Type | Method and Description |
---|---|
static int |
decodeVIntSize(byte value)
Parse the first byte of a vint/vlong to determine the number of bytes.
|
static void |
displayByteArray(byte[] record)
Test Utility Method Display Byte Array.
|
static int |
getVIntSize(long i)
Get the encoded length if an integer is stored in a variable-length format.
|
static boolean |
isNegativeVInt(byte value)
Given the first byte of a vint/vlong, determine the sign.
|
static byte[] |
readCompressedByteArray(DataInput in) |
static String |
readCompressedString(DataInput in)
Ugly utility, maybe someone else can do this better.
|
static String[] |
readCompressedStringArray(DataInput in)
Write a String array as a Nework Int N, followed by Int N Byte Array Strings.
|
static String |
readString(DataInput in)
Read a String as a Network Int n, followed by n Bytes
Alternative to 16 bit read/writeUTF.
|
static String[] |
readStringArray(DataInput in)
Write a String array as a Nework Int N, followed by Int N Byte Array Strings.
|
static int |
readVInt(DataInput stream)
Reads a zero-compressed encoded integer from input stream and returns it.
|
static long |
readVLong(DataInput stream)
Reads a zero-compressed encoded long from input stream and returns it.
|
static void |
skipCompressedByteArray(DataInput in) |
static void |
skipFully(DataInput in,
int len)
Skip len number of bytes in input streamin.
|
static int |
writeCompressedByteArray(DataOutput out,
byte[] bytes) |
static int |
writeCompressedString(DataOutput out,
String s) |
static void |
writeCompressedStringArray(DataOutput out,
String[] s) |
static void |
writeString(DataOutput out,
String s)
Write a String as a Network Int n, followed by n Bytes
Alternative to 16 bit read/writeUTF.
|
static void |
writeStringArray(DataOutput out,
String[] s)
Write a String array as a Nework Int N, followed by Int N Byte Array Strings.
|
static void |
writeVInt(DataOutput stream,
int i)
Serializes an integer to a binary stream with zero-compressed encoding.
|
static void |
writeVLong(DataOutput stream,
long i)
Serializes a long to a binary stream with zero-compressed encoding.
|
public static byte[] readCompressedByteArray(DataInput in) throws IOException
IOException
public static void skipCompressedByteArray(DataInput in) throws IOException
IOException
public static int writeCompressedByteArray(DataOutput out, byte[] bytes) throws IOException
IOException
public static String readCompressedString(DataInput in) throws IOException
IOException
public static int writeCompressedString(DataOutput out, String s) throws IOException
IOException
public static void writeString(DataOutput out, String s) throws IOException
IOException
public static String readString(DataInput in) throws IOException
IOException
public static void writeStringArray(DataOutput out, String[] s) throws IOException
IOException
public static void writeCompressedStringArray(DataOutput out, String[] s) throws IOException
IOException
public static String[] readStringArray(DataInput in) throws IOException
IOException
public static String[] readCompressedStringArray(DataInput in) throws IOException
IOException
public static void displayByteArray(byte[] record)
public static void writeVInt(DataOutput stream, int i) throws IOException
stream
- Binary output streami
- Integer to be serializedIOException
public static void writeVLong(DataOutput stream, long i) throws IOException
stream
- Binary output streami
- Long to be serializedIOException
public static long readVLong(DataInput stream) throws IOException
stream
- Binary input streamIOException
public static int readVInt(DataInput stream) throws IOException
stream
- Binary input streamIOException
public static boolean isNegativeVInt(byte value)
value
- the first bytepublic static int decodeVIntSize(byte value)
value
- the first byte of the vint/vlongpublic static int getVIntSize(long i)
public static void skipFully(DataInput in, int len) throws IOException
in
- input streamlen
- number of bytes to skipIOException
- when skipped less number of bytesCopyright © 2023 The Apache Software Foundation. All rights reserved.