- java.lang.Object
-
- java.io.InputStream
-
- io.ByteReader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ByteReader extends java.io.InputStream
-
-
Constructor Summary
Constructors Constructor Description ByteReader(java.io.InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteReader
changeEndiannes()
void
close()
int
getPosition()
int
read()
int
read(byte[] b, int off, int len)
long
read2bytes()
long
read3bytes()
long
read4bytes()
long
read5bytes()
long
read6bytes()
long
read7bytes()
long
read8bytes()
java.lang.String
readString(int sz)
reads 0-terminated string in default code pagejava.lang.String
readUnicodeString()
reads unicode string that has 2 bytes at start indicates length of stringjava.lang.String
readUnicodeString(int sz)
reads 0-terminated string in unicodeboolean
seek(int n)
-
-
-
Method Detail
-
getPosition
public int getPosition()
-
changeEndiannes
public ByteReader changeEndiannes()
-
seek
public boolean seek(int n) throws java.io.IOException
- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] b, int off, int len) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read2bytes
public long read2bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read3bytes
public long read3bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read4bytes
public long read4bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read5bytes
public long read5bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read6bytes
public long read6bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read7bytes
public long read7bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
read8bytes
public long read8bytes() throws java.io.IOException
- Throws:
java.io.IOException
-
readString
public java.lang.String readString(int sz) throws java.io.IOException
reads 0-terminated string in default code page- Parameters:
sz
- - maximum size in bytes- Throws:
java.io.IOException
-
readUnicodeString
public java.lang.String readUnicodeString(int sz) throws java.io.IOException
reads 0-terminated string in unicode- Parameters:
sz
- - maximum size in charcters- Throws:
java.io.IOException
-
readUnicodeString
public java.lang.String readUnicodeString() throws java.io.IOException
reads unicode string that has 2 bytes at start indicates length of string- Throws:
java.io.IOException
-
-