public class DataIO extends Object
Constructor and Description |
---|
DataIO() |
Modifier and Type | Method and Description |
---|---|
static String |
decodeUTF8(ByteBuffer in,
int length) |
static long |
lengthUTFv(String string) |
static int |
lengthVnumber(int v) |
static int |
lengthVnumber(long v) |
static int |
lengthVPNnumber(int v) |
static int |
lengthVPNnumber(long v) |
static byte[] |
readByteArray(DataInput in) |
static int[] |
readIntArray(DataInput in) |
static int[] |
readIntArrayDelta(DataInput in) |
static long[] |
readLongArray(DataInput in) |
static long[] |
readLongArrayDelta(DataInput in) |
static long |
readRestOfVlong(DataInput in,
int firstByte) |
static int |
readUnsignedByte(DataInput in) |
static String |
readUTFv(DataInput in) |
static long |
readVlong(DataInput in) |
static int |
readVnumber(DataInput in) |
static void |
writeByte(DataOutput out,
int v)
DataOutputStream writeByte with checking of argument
|
static void |
writeByteArray(DataOutput out,
byte[] v) |
static void |
writeIntArray(DataOutput out,
int[] v)
write array preceded by its length
|
static void |
writeIntArrayDelta(DataOutput out,
int[] v)
Write delta encoded value, for increasing values
|
static void |
writeLongArray(DataOutput out,
long[] v) |
static void |
writeLongArrayDelta(DataOutput out,
long[] v) |
static void |
writeShort(DataOutput out,
int v)
DataOutputStream writeShort with checking of argument
|
static void |
writeUnsignedByte(DataOutput out,
int v)
Write lower 8 bits
|
static void |
writeUTFv(String string,
DataOutput out)
Similar to writeUTF, but ok for strings > 32K bytes long and better for strings < 127
string utf-8 length must be ≤ Integer.MAX_VALUE - 1
|
static void |
writeVnumber(DataOutput out,
int v)
Write a positive number with the fewest bytes possible
up to 127 written as a byte
high order bit on means get another byte
Note: value treated as unsigned 32 bit int
|
static void |
writeVnumber(DataOutput out,
long v)
Write a positive long with the fewest bytes possible; up to 127 written as a byte, high order
bit on means get another byte.
|
static void |
writeVPNnumber(DataOutput out,
int v)
write a positive or negative number, optimized for fewer bytes near 0
sign put in low order bit, rest of number converted to positive and shifted left 1
max negative written as - 0.
|
static void |
writeVPNnumber(DataOutput out,
long v) |
public static final Charset UTF8
public static String decodeUTF8(ByteBuffer in, int length)
public static void writeUTFv(String string, DataOutput out) throws IOException
string
- the string to writeout
- the output sinkIOException
- passthrupublic static String readUTFv(DataInput in) throws IOException
IOException
public static long lengthUTFv(String string) throws UnsupportedEncodingException
UnsupportedEncodingException
public static void writeShort(DataOutput out, int v) throws IOException
out
- the output sinkv
- the value to writeIOException
- passthrupublic static void writeByte(DataOutput out, int v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static void writeUnsignedByte(DataOutput out, int v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static void writeVPNnumber(DataOutput out, int v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static void writeVPNnumber(DataOutput out, long v) throws IOException
IOException
public static int lengthVPNnumber(int v)
public static int lengthVPNnumber(long v)
public static void writeVnumber(DataOutput out, int v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static int lengthVnumber(int v)
public static int readVnumber(DataInput in) throws IOException
IOException
public static void writeVnumber(DataOutput out, long v) throws IOException
out
- output sinkv
- the value to write is never negativeIOException
- passthrupublic static int lengthVnumber(long v)
public static long readVlong(DataInput in) throws IOException
IOException
public static long readRestOfVlong(DataInput in, int firstByte) throws IOException
IOException
public static void writeByteArray(DataOutput out, byte[] v) throws IOException
IOException
public static byte[] readByteArray(DataInput in) throws IOException
IOException
public static void writeIntArray(DataOutput out, int[] v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static int[] readIntArray(DataInput in) throws IOException
IOException
public static void writeIntArrayDelta(DataOutput out, int[] v) throws IOException
out
- output sinkv
- the value to writeIOException
- passthrupublic static int[] readIntArrayDelta(DataInput in) throws IOException
IOException
public static void writeLongArray(DataOutput out, long[] v) throws IOException
IOException
public static long[] readLongArray(DataInput in) throws IOException
IOException
public static void writeLongArrayDelta(DataOutput out, long[] v) throws IOException
IOException
public static long[] readLongArrayDelta(DataInput in) throws IOException
IOException
public static int readUnsignedByte(DataInput in) throws IOException
IOException
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.