public final class WritableUtils extends Object
| Constructor and Description |
|---|
WritableUtils() |
| Modifier and Type | Method and Description |
|---|---|
static void |
displayByteArray(byte[] record) |
static int |
getVIntSize(long i)
Get the encoded length if an integer is stored in a variable-length format
|
static byte[] |
readCompressedByteArray(DataInput in) |
static String |
readCompressedString(DataInput in) |
static String[] |
readCompressedStringArray(DataInput in) |
static <T extends Enum<T>> |
readEnum(DataInput in,
Class<T> enumType)
Read an Enum value from DataInput, Enums are read and written
using String values.
|
static String |
readString(DataInput in) |
static String[] |
readStringArray(DataInput in) |
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 int |
writeCompressedByteArray(DataOutput out,
byte[] bytes) |
static int |
writeCompressedString(DataOutput out,
String s) |
static void |
writeCompressedStringArray(DataOutput out,
String[] s) |
static void |
writeEnum(DataOutput out,
Enum enumVal)
writes String value of enum to DataOutput.
|
static void |
writeString(DataOutput out,
String s) |
static void |
writeStringArray(DataOutput out,
String[] s) |
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
IOExceptionpublic static void skipCompressedByteArray(DataInput in) throws IOException
IOExceptionpublic static int writeCompressedByteArray(DataOutput out, byte[] bytes) throws IOException
IOExceptionpublic static String readCompressedString(DataInput in) throws IOException
IOExceptionpublic static int writeCompressedString(DataOutput out, String s) throws IOException
IOExceptionpublic static void writeString(DataOutput out, String s) throws IOException
IOExceptionpublic static String readString(DataInput in) throws IOException
IOExceptionpublic static void writeStringArray(DataOutput out, String[] s) throws IOException
IOExceptionpublic static void writeCompressedStringArray(DataOutput out, String[] s) throws IOException
IOExceptionpublic static String[] readStringArray(DataInput in) throws IOException
IOExceptionpublic static String[] readCompressedStringArray(DataInput in) throws IOException
IOExceptionpublic static void displayByteArray(byte[] record)
public static void writeVInt(DataOutput stream, int i) throws IOException
stream - Binary output streami - Integer to be serializedIOExceptionpublic static void writeVLong(DataOutput stream, long i) throws IOException
stream - Binary output streami - Long to be serializedIOExceptionpublic static long readVLong(DataInput stream) throws IOException
stream - Binary input streamIOExceptionpublic static int readVInt(DataInput stream) throws IOException
stream - Binary input streamIOExceptionpublic static int getVIntSize(long i)
public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException
T - Enum typein - DataInput to read fromenumType - Class type of EnumIOExceptionpublic static void writeEnum(DataOutput out, Enum enumVal) throws IOException
out - Dataoutput streamenumVal - enum valueIOExceptionCopyright © 2007, 2014, Oracle and/or its affiliates. All rights reserved.