Package com.google.common.io
Class LittleEndianDataInputStream
- java.lang.Object
- 
- java.io.InputStream
- 
- java.io.FilterInputStream
- 
- com.google.common.io.LittleEndianDataInputStream
 
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.DataInput,- java.lang.AutoCloseable
 
 @GwtIncompatible public final class LittleEndianDataInputStream extends java.io.FilterInputStream implements java.io.DataInput An implementation ofDataInputthat uses little-endian byte ordering for readingshort,int,float,double, andlongvalues.Note: This class intentionally violates the specification of its supertype DataInput, which explicitly requires big-endian byte order.- Since:
- 8.0
- Author:
- Chris Nokleberg, Keith Bottner
 
- 
- 
Constructor SummaryConstructors Constructor Description LittleEndianDataInputStream(java.io.InputStream in)Creates aLittleEndianDataInputStreamthat wraps the given stream.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanreadBoolean()bytereadByte()charreadChar()Reads a char as specified byDataInputStream.readChar(), except using little-endian byte order.doublereadDouble()Reads adoubleas specified byDataInputStream.readDouble(), except using little-endian byte order.floatreadFloat()Reads afloatas specified byDataInputStream.readFloat(), except using little-endian byte order.voidreadFully(byte[] b)voidreadFully(byte[] b, int off, int len)intreadInt()Reads an integer as specified byDataInputStream.readInt(), except using little-endian byte order.java.lang.StringreadLine()This method will throw anUnsupportedOperationException.longreadLong()Reads alongas specified byDataInputStream.readLong(), except using little-endian byte order.shortreadShort()Reads ashortas specified byDataInputStream.readShort(), except using little-endian byte order.intreadUnsignedByte()intreadUnsignedShort()Reads an unsignedshortas specified byDataInputStream.readUnsignedShort(), except using little-endian byte order.java.lang.StringreadUTF()intskipBytes(int n)- 
Methods inherited from class java.io.FilterInputStreamavailable, close, mark, markSupported, read, read, read, reset, skip
 
- 
 
- 
- 
- 
Constructor Detail- 
LittleEndianDataInputStreampublic LittleEndianDataInputStream(java.io.InputStream in) Creates aLittleEndianDataInputStreamthat wraps the given stream.- Parameters:
- in- the stream to delegate to
 
 
- 
 - 
Method Detail- 
readLine@CanIgnoreReturnValue public java.lang.String readLine() This method will throw anUnsupportedOperationException.- Specified by:
- readLinein interface- java.io.DataInput
 
 - 
readFullypublic void readFully(byte[] b) throws java.io.IOException - Specified by:
- readFullyin interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
readFullypublic void readFully(byte[] b, int off, int len) throws java.io.IOException - Specified by:
- readFullyin interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
skipBytespublic int skipBytes(int n) throws java.io.IOException - Specified by:
- skipBytesin interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
readUnsignedByte@CanIgnoreReturnValue public int readUnsignedByte() throws java.io.IOException - Specified by:
- readUnsignedBytein interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
readUnsignedShort@CanIgnoreReturnValue public int readUnsignedShort() throws java.io.IOException Reads an unsignedshortas specified byDataInputStream.readUnsignedShort(), except using little-endian byte order.- Specified by:
- readUnsignedShortin interface- java.io.DataInput
- Returns:
- the next two bytes of the input stream, interpreted as an unsigned 16-bit integer in little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readInt@CanIgnoreReturnValue public int readInt() throws java.io.IOException Reads an integer as specified byDataInputStream.readInt(), except using little-endian byte order.- Specified by:
- readIntin interface- java.io.DataInput
- Returns:
- the next four bytes of the input stream, interpreted as an intin little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readLong@CanIgnoreReturnValue public long readLong() throws java.io.IOException Reads alongas specified byDataInputStream.readLong(), except using little-endian byte order.- Specified by:
- readLongin interface- java.io.DataInput
- Returns:
- the next eight bytes of the input stream, interpreted as a longin little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readFloat@CanIgnoreReturnValue public float readFloat() throws java.io.IOException Reads afloatas specified byDataInputStream.readFloat(), except using little-endian byte order.- Specified by:
- readFloatin interface- java.io.DataInput
- Returns:
- the next four bytes of the input stream, interpreted as a floatin little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readDouble@CanIgnoreReturnValue public double readDouble() throws java.io.IOException Reads adoubleas specified byDataInputStream.readDouble(), except using little-endian byte order.- Specified by:
- readDoublein interface- java.io.DataInput
- Returns:
- the next eight bytes of the input stream, interpreted as a doublein little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readUTF@CanIgnoreReturnValue public java.lang.String readUTF() throws java.io.IOException - Specified by:
- readUTFin interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
readShort@CanIgnoreReturnValue public short readShort() throws java.io.IOException Reads ashortas specified byDataInputStream.readShort(), except using little-endian byte order.- Specified by:
- readShortin interface- java.io.DataInput
- Returns:
- the next two bytes of the input stream, interpreted as a shortin little-endian byte order.
- Throws:
- java.io.IOException- if an I/O error occurs.
 
 - 
readChar@CanIgnoreReturnValue public char readChar() throws java.io.IOException Reads a char as specified byDataInputStream.readChar(), except using little-endian byte order.- Specified by:
- readCharin interface- java.io.DataInput
- Returns:
- the next two bytes of the input stream, interpreted as a charin little-endian byte order
- Throws:
- java.io.IOException- if an I/O error occurs
 
 - 
readByte@CanIgnoreReturnValue public byte readByte() throws java.io.IOException - Specified by:
- readBytein interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 - 
readBoolean@CanIgnoreReturnValue public boolean readBoolean() throws java.io.IOException - Specified by:
- readBooleanin interface- java.io.DataInput
- Throws:
- java.io.IOException
 
 
- 
 
-