@InterfaceAudience.Private public class StreamUtils extends Object
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
static long |
readLong(InputStream in) |
static Pair<Integer,Integer> |
readRawVarint32(byte[] input,
int offset)
Reads a varInt value stored in an array.
|
static int |
readRawVarint32(ByteBuff input) |
static Pair<Integer,Integer> |
readRawVarint32(ByteBuffer input,
int offset) |
static int |
readRawVarint32(InputStream input) |
static short |
toShort(byte hi,
byte lo) |
static void |
writeInt(OutputStream out,
int v) |
static void |
writeLong(OutputStream out,
long v) |
static void |
writeRawVInt32(OutputStream output,
int value) |
static void |
writeShort(OutputStream out,
short v) |
public StreamUtils()
public static void writeRawVInt32(OutputStream output, int value) throws IOException
IOException
public static int readRawVarint32(InputStream input) throws IOException
IOException
public static int readRawVarint32(ByteBuff input) throws IOException
IOException
public static Pair<Integer,Integer> readRawVarint32(byte[] input, int offset) throws IOException
input
- Input array where the varInt is availableoffset
- Offset in the input array where varInt is availableIOException
- When varint is malformed and not able to be read correctlypublic static Pair<Integer,Integer> readRawVarint32(ByteBuffer input, int offset) throws IOException
IOException
public static short toShort(byte hi, byte lo)
public static void writeShort(OutputStream out, short v) throws IOException
IOException
public static void writeInt(OutputStream out, int v) throws IOException
IOException
public static void writeLong(OutputStream out, long v) throws IOException
IOException
public static long readLong(InputStream in) throws IOException
IOException
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.