Package com.automation_pros.odva.endian
Class EndianInputStream
- java.lang.Object
-
- java.io.InputStream
-
- com.automation_pros.odva.endian.EndianInputStream
-
- All Implemented Interfaces:
EndianDataInput
,java.io.Closeable
,java.io.DataInput
,java.lang.AutoCloseable
public class EndianInputStream extends java.io.InputStream implements EndianDataInput
-
-
Constructor Summary
Constructors Constructor Description EndianInputStream(java.io.InputStream in)
EndianInputStream(java.io.InputStream in, int skip)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EndianInputStream
asLimitedInput(long limit)
Returns an instance that reads from the current data source up to the number of bytes specified.int
available()
protected void
checkReadSkip(int n)
void
close()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] dst)
int
read(byte[] dst, int offset, int length)
boolean
readBoolean()
byte
readByte()
char
readChar()
char
readCharLE()
Little-endian alternative to readChar()double
readDouble()
double
readDoubleLE()
Little-endian alternative to readDouble()float
readFloat()
float
readFloatLE()
Little-endian alternative to readFloat()void
readFully(byte[] dst)
void
readFully(byte[] dst, int offset, int length)
int
readInt()
int
readIntLE()
Little-endian alternative to readInt()java.lang.String
readLine()
long
readLong()
long
readLongLE()
Little-endian alternative to readLong()short
readShort()
short
readShortLE()
Little-endian alternative to readShort()int
readUnsignedByte()
long
readUnsignedInt()
Extension to the DataInput interface similar to readUnsignedShort(), but delivering an unsigned integer in a long.long
readUnsignedIntLE()
Little-endian alternative to readUnsignedInt()java.math.BigInteger
readUnsignedLong()
Extension to the DataInput interface similar to readUnsignedShort(), but delivering an unsigned long in a bignum.java.math.BigInteger
readUnsignedLongLE()
Little-endian alternative to readUnsignedLong()int
readUnsignedShort()
int
readUnsignedShortLE()
Little-endian alternative to readUnsignedShort()java.lang.String
readUTF()
void
reset()
long
skip(long n)
int
skipBytes(int n)
-
-
-
Method Detail
-
read
public int read() throws java.io.IOException
- Specified by:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] dst) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
read
public int read(byte[] dst, int offset, int length) throws java.io.IOException
- Overrides:
read
in classjava.io.InputStream
- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skip
in classjava.io.InputStream
- 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
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classjava.io.InputStream
-
reset
public void reset() throws java.io.IOException
- Overrides:
reset
in classjava.io.InputStream
- Throws:
java.io.IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classjava.io.InputStream
-
readFully
public void readFully(byte[] dst) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFully
public void readFully(byte[] dst, int offset, int length) throws java.io.IOException
- Specified by:
readFully
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
skipBytes
public int skipBytes(int n) throws java.io.IOException
- Specified by:
skipBytes
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readBoolean
public boolean readBoolean() throws java.io.IOException
- Specified by:
readBoolean
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readByte
public byte readByte() throws java.io.IOException
- Specified by:
readByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedByte
public int readUnsignedByte() throws java.io.IOException
- Specified by:
readUnsignedByte
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
checkReadSkip
protected void checkReadSkip(int n) throws java.io.IOException
- Throws:
java.io.IOException
-
readShort
public short readShort() throws java.io.IOException
- Specified by:
readShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUnsignedShort
public int readUnsignedShort() throws java.io.IOException
- Specified by:
readUnsignedShort
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readChar
public char readChar() throws java.io.IOException
- Specified by:
readChar
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readInt
public int readInt() throws java.io.IOException
- Specified by:
readInt
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLong
public long readLong() throws java.io.IOException
- Specified by:
readLong
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readFloat
public float readFloat() throws java.io.IOException
- Specified by:
readFloat
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readDouble
public double readDouble() throws java.io.IOException
- Specified by:
readDouble
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readLine
public java.lang.String readLine() throws java.io.IOException
- Specified by:
readLine
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
readUTF
public java.lang.String readUTF() throws java.io.IOException
- Specified by:
readUTF
in interfacejava.io.DataInput
- Throws:
java.io.IOException
-
available
public int available() throws java.io.IOException
- Overrides:
available
in classjava.io.InputStream
- Throws:
java.io.IOException
-
readShortLE
public short readShortLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readShort()- Specified by:
readShortLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readCharLE
public char readCharLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readChar()- Specified by:
readCharLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readDoubleLE
public double readDoubleLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readDouble()- Specified by:
readDoubleLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readFloatLE
public float readFloatLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readFloat()- Specified by:
readFloatLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readIntLE
public int readIntLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readInt()- Specified by:
readIntLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readLongLE
public long readLongLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readLong()- Specified by:
readLongLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readUnsignedShortLE
public int readUnsignedShortLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readUnsignedShort()- Specified by:
readUnsignedShortLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readUnsignedInt
public long readUnsignedInt() throws java.io.IOException
Description copied from interface:EndianDataInput
Extension to the DataInput interface similar to readUnsignedShort(), but delivering an unsigned integer in a long.- Specified by:
readUnsignedInt
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readUnsignedIntLE
public long readUnsignedIntLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readUnsignedInt()- Specified by:
readUnsignedIntLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readUnsignedLong
public java.math.BigInteger readUnsignedLong() throws java.io.IOException
Description copied from interface:EndianDataInput
Extension to the DataInput interface similar to readUnsignedShort(), but delivering an unsigned long in a bignum.- Specified by:
readUnsignedLong
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
readUnsignedLongLE
public java.math.BigInteger readUnsignedLongLE() throws java.io.IOException
Description copied from interface:EndianDataInput
Little-endian alternative to readUnsignedLong()- Specified by:
readUnsignedLongLE
in interfaceEndianDataInput
- Returns:
- Throws:
java.io.IOException
-
asLimitedInput
public EndianInputStream asLimitedInput(long limit)
Description copied from interface:EndianDataInput
Returns an instance that reads from the current data source up to the number of bytes specified.- Specified by:
asLimitedInput
in interfaceEndianDataInput
- Parameters:
limit
- Number of bytes to read from this subordinate source before signalling end of file. Underlying implementations may truncate this to 32 bits.- Returns:
-
-