javadoc.com.google.common.io.LittleEndianDataInputStream.html Maven / Gradle / Ivy
The newest version!
LittleEndianDataInputStream (Guava: Google Core Libraries for Java 11.0.1 API)
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
PREV CLASS
NEXT CLASS
FRAMES
NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD
DETAIL: FIELD | CONSTR | METHOD
com.google.common.io
Class LittleEndianDataInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.google.common.io.LittleEndianDataInputStream
@Beta
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 Summary |
---|
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
LittleEndianDataInputStream(InputStream in)
Creates a LittleEndianDataInputStream that wraps the given stream. |
Method Summary | |
---|---|
boolean |
readBoolean()
|
byte |
readByte()
|
char |
readChar()
Reads a char as specified by DataInputStream.readChar() , except
using little-endian byte order. |
double |
readDouble()
Reads a double as specified by
DataInputStream.readDouble() , except using little-endian byte
order. |
float |
readFloat()
Reads a float as specified by DataInputStream.readFloat() ,
except using little-endian byte order. |
void |
readFully(byte[] b)
|
void |
readFully(byte[] b,
int off,
int len)
|
int |
readInt()
Reads an integer as specified by DataInputStream.readInt() , except
using little-endian byte order. |
String |
readLine()
This method will throw an UnsupportedOperationException . |
long |
readLong()
Reads a long as specified by DataInputStream.readLong() ,
except using little-endian byte order. |
short |
readShort()
Reads a short as specified by DataInputStream.readShort() ,
except using little-endian byte order. |
int |
readUnsignedByte()
|
int |
readUnsignedShort()
Reads an unsigned short as specified by
DataInputStream.readUnsignedShort() , except using little-endian
byte order. |
String |
readUTF()
|
int |
skipBytes(int n)
|
Methods inherited from class java.io.FilterInputStream |
---|
available, close, mark, markSupported, read, read, read, reset, skip |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
LittleEndianDataInputStream
public LittleEndianDataInputStream(InputStream in)
- Creates a
LittleEndianDataInputStream
that wraps the given stream.- Parameters:
in
- the stream to delegate to
Method Detail |
---|
readLine
public String readLine()
- This method will throw an
UnsupportedOperationException
.
readFully
public void readFully(byte[] b) throws IOException
- Throws:
IOException
readFully
public void readFully(byte[] b, int off, int len) throws IOException
- Throws:
IOException
skipBytes
public int skipBytes(int n) throws IOException
- Throws:
IOException
readUnsignedByte
public int readUnsignedByte() throws IOException
- Specified by:
readUnsignedByte
in interfaceDataInput
- Throws:
IOException
readUnsignedShort
public int readUnsignedShort() throws IOException
- Reads an unsigned
short
as specified byDataInputStream.readUnsignedShort()
, except using little-endian byte order.- Specified by:
readUnsignedShort
in interfaceDataInput
- 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
readInt
public int readInt() throws IOException
- Reads an integer as specified by
DataInputStream.readInt()
, except using little-endian byte order.- Returns:
- the next four bytes of the input stream, interpreted as an
int
in little-endian byte order - Throws:
IOException
- if an I/O error occurs
readLong
public long readLong() throws IOException
- Reads a
long
as specified byDataInputStream.readLong()
, except using little-endian byte order.- Returns:
- the next eight bytes of the input stream, interpreted as a
long
in little-endian byte order - Throws:
IOException
- if an I/O error occurs
readFloat
public float readFloat() throws IOException
- Reads a
float
as specified byDataInputStream.readFloat()
, except using little-endian byte order.- Returns:
- the next four bytes of the input stream, interpreted as a
float
in little-endian byte order - Throws:
IOException
- if an I/O error occurs
readDouble
public double readDouble() throws IOException
- Reads a
double
as specified byDataInputStream.readDouble()
, except using little-endian byte order.- Specified by:
readDouble
in interfaceDataInput
- Returns:
- the next eight bytes of the input stream, interpreted as a
double
in little-endian byte order - Throws:
IOException
- if an I/O error occurs
readUTF
public String readUTF() throws IOException
- Throws:
IOException
readShort
public short readShort() throws IOException
- Reads a
short
as specified byDataInputStream.readShort()
, except using little-endian byte order.- Returns:
- the next two bytes of the input stream, interpreted as a
short
in little-endian byte order. - Throws:
IOException
- if an I/O error occurs.
readChar
public char readChar() throws IOException
- Reads a char as specified by
DataInputStream.readChar()
, except using little-endian byte order.- Returns:
- the next two bytes of the input stream, interpreted as a
char
in little-endian byte order - Throws:
IOException
- if an I/O error occurs
readByte
public byte readByte() throws IOException
- Throws:
IOException
readBoolean
public boolean readBoolean() throws IOException
- Specified by:
readBoolean
in interfaceDataInput
- Throws:
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010-2012. All Rights Reserved.
© 2015 - 2025 Weber Informatics LLC | Privacy Policy