Class LittleEndianDataInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.google.common.io.LittleEndianDataInputStream
- All Implemented Interfaces:
- Closeable,- DataInput,- AutoCloseable
@GwtIncompatible
public final class LittleEndianDataInputStream
extends FilterInputStream
implements DataInput
An implementation of 
DataInput that uses little-endian byte ordering for reading 
 short, int, float, double, and long values.
 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
- 
Field SummaryFields inherited from class java.io.FilterInputStreamin
- 
Constructor SummaryConstructorsConstructorDescriptionCreates aLittleEndianDataInputStreamthat wraps the given stream.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanbytereadByte()charreadChar()Reads a char as specified byDataInputStream.readChar(), except using little-endian byte order.doubleReads adoubleas specified byDataInputStream.readDouble(), except using little-endian byte order.floatReads 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.readLine()This method will throw anUnsupportedOperationException.longreadLong()Reads alongas specified byDataInputStream.readLong(), except using little-endian byte order.shortReads ashortas specified byDataInputStream.readShort(), except using little-endian byte order.intintReads an unsignedshortas specified byDataInputStream.readUnsignedShort(), except using little-endian byte order.readUTF()intskipBytes(int n) Methods inherited from class java.io.FilterInputStreamavailable, close, mark, markSupported, read, read, read, reset, skipMethods inherited from class java.io.InputStreamnullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
- 
Constructor Details- 
LittleEndianDataInputStreamCreates aLittleEndianDataInputStreamthat wraps the given stream.- Parameters:
- in- the stream to delegate to
 
 
- 
- 
Method Details- 
readLineThis method will throw anUnsupportedOperationException.
- 
readFully- Specified by:
- readFullyin interface- DataInput
- Throws:
- IOException
 
- 
readFully- Specified by:
- readFullyin interface- DataInput
- Throws:
- IOException
 
- 
skipBytes- Specified by:
- skipBytesin interface- DataInput
- Throws:
- IOException
 
- 
readUnsignedByte- Specified by:
- readUnsignedBytein interface- DataInput
- Throws:
- IOException
 
- 
readUnsignedShortReads an unsignedshortas specified byDataInputStream.readUnsignedShort(), except using little-endian byte order.- Specified by:
- readUnsignedShortin interface- DataInput
- Returns:
- the next two bytes of the input stream, interpreted as an unsigned 16-bit integer in little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readIntReads an integer as specified byDataInputStream.readInt(), except using little-endian byte order.- Specified by:
- readIntin interface- DataInput
- Returns:
- the next four bytes of the input stream, interpreted as an intin little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readLongReads alongas specified byDataInputStream.readLong(), except using little-endian byte order.- Specified by:
- readLongin interface- DataInput
- Returns:
- the next eight bytes of the input stream, interpreted as a longin little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readFloatReads afloatas specified byDataInputStream.readFloat(), except using little-endian byte order.- Specified by:
- readFloatin interface- DataInput
- Returns:
- the next four bytes of the input stream, interpreted as a floatin little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readDoubleReads adoubleas specified byDataInputStream.readDouble(), except using little-endian byte order.- Specified by:
- readDoublein interface- DataInput
- Returns:
- the next eight bytes of the input stream, interpreted as a doublein little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readUTF- Specified by:
- readUTFin interface- DataInput
- Throws:
- IOException
 
- 
readShortReads ashortas specified byDataInputStream.readShort(), except using little-endian byte order.- Specified by:
- readShortin interface- DataInput
- Returns:
- the next two bytes of the input stream, interpreted as a shortin little-endian byte order.
- Throws:
- IOException- if an I/O error occurs.
 
- 
readCharReads a char as specified byDataInputStream.readChar(), except using little-endian byte order.- Specified by:
- readCharin interface- DataInput
- Returns:
- the next two bytes of the input stream, interpreted as a charin little-endian byte order
- Throws:
- IOException- if an I/O error occurs
 
- 
readByte- Specified by:
- readBytein interface- DataInput
- Throws:
- IOException
 
- 
readBoolean- Specified by:
- readBooleanin interface- DataInput
- Throws:
- IOException
 
 
-