public abstract class BinaryReader extends InputStream
Constructor and Description |
---|
BinaryReader(InputStream in) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
expect(byte[] out)
Read binary data from stream.
|
Binary |
expectBinary(int bytes)
Read binary data from stream.
|
byte |
expectByte()
Read a byte from the input stream.
|
byte[] |
expectBytes(int bytes)
Read binary data from stream.
|
double |
expectDouble()
Read a double from the input stream.
|
int |
expectInt()
Read an int from the input stream.
|
long |
expectLong()
Read a long int from the input stream.
|
short |
expectShort()
Read a short from the input stream.
|
long |
expectSigned(int bytes)
Read an signed number from the input stream.
|
int |
expectUInt16()
Read an unsigned short from the input stream.
|
int |
expectUInt24()
Read an unsigned short from the input stream.
|
int |
expectUInt32()
Read an unsigned int from the input stream.
|
int |
expectUInt8()
Read an unsigned byte from the input stream.
|
int |
expectUnsigned(int bytes)
Read an unsigned number from the input stream.
|
int |
read()
Read a single byte.
|
int |
read(byte[] out)
Read binary data from stream.
|
int |
read(byte[] out,
int off,
int len)
Read binary data from stream.
|
int |
readIntVarint()
Write a signed number as varint (integer with variable number of bytes,
determined as part of the bytes themselves.
|
int |
readIntZigzag()
Read a long number as zigzag encoded from the stream.
|
long |
readLongVarint()
Write a signed number as varint (integer with variable number of bytes,
determined as part of the bytes themselves.
|
long |
readLongZigzag()
Read a long number as zigzag encoded from the stream.
|
int |
readUInt16()
Read an unsigned short from the input stream.
|
protected abstract int |
unshift2bytes(int b1,
int b2) |
protected abstract int |
unshift3bytes(int b1,
int b2,
int b3) |
protected abstract int |
unshift4bytes(int b1,
int b2,
int b3,
int b4) |
protected abstract long |
unshift8bytes(long b1,
long b2,
long b3,
long b4,
long b5,
long b6,
long b7,
long b8) |
available, mark, markSupported, reset, skip
public BinaryReader(InputStream in)
public int read() throws IOException
read
in class InputStream
IOException
- if unable to read from stream.public int read(byte[] out) throws IOException
read
in class InputStream
out
- The output buffer to read into.IOException
- if unable to read from stream.public int read(byte[] out, int off, int len) throws IOException
read
in class InputStream
out
- The output buffer to read into.off
- Offset in out array to writeBinary to.len
- Number of bytes to read.IOException
- if unable to read from stream.public void expect(byte[] out) throws IOException
out
- The output buffer to read into.IOException
- if unable to read from stream.public void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
public byte expectByte() throws IOException
IOException
- If no byte to read.public short expectShort() throws IOException
IOException
- if unable to read from stream.public int expectInt() throws IOException
IOException
- if unable to read from stream.public long expectLong() throws IOException
IOException
- if unable to read from stream.public double expectDouble() throws IOException
IOException
- if unable to read from stream.public Binary expectBinary(int bytes) throws IOException
bytes
- Number of bytes to read.IOException
- if unable to read from stream.public byte[] expectBytes(int bytes) throws IOException
bytes
- Number of bytes to read.IOException
- if unable to read from stream.public int expectUInt8() throws IOException
IOException
- If no number to read.public int expectUInt16() throws IOException
IOException
- If no number to read.public int readUInt16() throws IOException
IOException
- If no number to read.public int expectUInt24() throws IOException
IOException
- If no number to read.public int expectUInt32() throws IOException
IOException
- If no number to read.public int expectUnsigned(int bytes) throws IOException
bytes
- Number of bytes to read.IOException
- if unable to read from stream.public long expectSigned(int bytes) throws IOException
bytes
- Number of bytes to read.IOException
- if unable to read from stream.public int readIntZigzag() throws IOException
IOException
- if unable to read from stream.public long readLongZigzag() throws IOException
IOException
- if unable to read from stream.public int readIntVarint() throws IOException
IOException
- if unable to read from stream.public long readLongVarint() throws IOException
IOException
- if unable to read from stream.protected abstract int unshift2bytes(int b1, int b2)
protected abstract int unshift3bytes(int b1, int b2, int b3)
protected abstract int unshift4bytes(int b1, int b2, int b3, int b4)
protected abstract long unshift8bytes(long b1, long b2, long b3, long b4, long b5, long b6, long b7, long b8)
Copyright © 2017. All rights reserved.