| Constructor and Description |
|---|
WritableUtils() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends Writable> |
clone(T orig,
Configuration conf)
通过Writable序列化方式拷贝一个Writable对象.
|
static int |
decodeVIntSize(byte value)
解析vint、vlong的首字节(表示其本身的长度)
|
static void |
displayByteArray(byte[] record)
打印出byte数组的字符串形式
|
static int |
getVIntSize(long i)
获取变长的int长度
|
static boolean |
isNegativeVInt(byte value)
解析vint、vlong的首字节判断其是否为负值
|
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)
从输入流中读取枚举值
|
static String |
readString(DataInput in)
从二进制输入流中读取字符串
|
static String[] |
readStringArray(DataInput in)
从二进制输入流中读取字符串数组
|
static int |
readVInt(DataInput stream)
从二进制流中读取vint.
|
static long |
readVLong(DataInput stream)
从二进制流中读取vlong.
|
static void |
skipCompressedByteArray(DataInput in) |
static void |
skipFully(DataInput in,
int len)
输入流中跳过指定长度的字节
|
static byte[] |
toByteArray(Writable... writables)
将Writable对象转化成byte数组
|
static int |
writeCompressedByteArray(DataOutput out,
byte[] bytes)
压缩写入byte数组到二进制输出流中
|
static int |
writeCompressedString(DataOutput out,
String s)
压缩写入字符串到二进制输出流中
|
static void |
writeCompressedStringArray(DataOutput out,
String[] s)
压缩写入字符串数组到二进制输出流中
|
static void |
writeEnum(DataOutput out,
Enum<?> enumVal)
写入枚举到输出流
|
static void |
writeString(DataOutput out,
String s)
写入字符串到二进制输出流中
|
static void |
writeStringArray(DataOutput out,
String[] s)
写入字符串数组到二进制输出流中
|
static void |
writeVInt(DataOutput stream,
int i)
vint方式序列化一个int到二进制输出流中
|
static void |
writeVLong(DataOutput stream,
long i)
vlong方式序列化一个long到二进制输出流中
|
public static byte[] readCompressedByteArray(DataInput in) throws IOException
in - 二进制输入流IOExceptionpublic static void skipCompressedByteArray(DataInput in) throws IOException
IOExceptionpublic static int writeCompressedByteArray(DataOutput out, byte[] bytes) throws IOException
out - 二进制输出流s - 写入的byte数组IOExceptionpublic static String readCompressedString(DataInput in) throws IOException
in - 二进制输入流IOExceptionpublic static int writeCompressedString(DataOutput out, String s) throws IOException
out - 二进制输出流s - 写入的字符串IOExceptionpublic static void writeString(DataOutput out, String s) throws IOException
out - 二进制输出流s - 写入的字符串IOExceptionpublic static String readString(DataInput in) throws IOException
in - 二进制输入流IOExceptionpublic static void writeStringArray(DataOutput out, String[] s) throws IOException
out - 二进制输出流s - 字符串数组IOExceptionpublic static void writeCompressedStringArray(DataOutput out, String[] s) throws IOException
out - 二进制输出流s - 字符串数组IOExceptionpublic static String[] readStringArray(DataInput in) throws IOException
in - 二进制输入流IOExceptionpublic static String[] readCompressedStringArray(DataInput in) throws IOException
in - 二进制输入流IOExceptionpublic static void displayByteArray(byte[] record)
record - byte数组public static void writeVInt(DataOutput stream, int i) throws IOException
stream - 二进制输出流i - int的值IOExceptionpublic static void writeVLong(DataOutput stream, long i) throws IOException
stream - 二进制输出流i - long的值IOExceptionpublic static long readVLong(DataInput stream) throws IOException
stream - 输入二进制流IOExceptionpublic static int readVInt(DataInput stream) throws IOException
stream - 输入二进制流IOExceptionpublic static boolean isNegativeVInt(byte value)
value - vint、vlong的首字节public static int decodeVIntSize(byte value)
value - vint、vlong的首字节public static int getVIntSize(long i)
i - int值public static <T extends Enum<T>> T readEnum(DataInput in, Class<T> enumType) throws IOException
T - Enum 枚举类型in - 输入流enumType - 枚举类IOExceptionpublic static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException
out - 输出流enumVal - 枚举值IOExceptionpublic static void skipFully(DataInput in, int len) throws IOException
in - 输入流len - 指定字节长度IOExceptionpublic static byte[] toByteArray(Writable... writables)
writables - Writable对象集合public static <T extends Writable> T clone(T orig, Configuration conf)
orig - 拷贝源对象IOExceptionCopyright © 2021 Alibaba Cloud Computing. All rights reserved.