Package org.apache.commons.io.input
Class SwappedDataInputStream
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.SwappedDataInputStream
- All Implemented Interfaces:
- Closeable,- DataInput,- AutoCloseable
DataInput for systems relying on little-endian data formats. When read, values will be changed from little-endian to
 big-endian formats for internal usage.
 
Provenance: Avalon Excalibur (IO)
- 
Nested Class SummaryNested classes/interfaces inherited from class org.apache.commons.io.input.ProxyInputStreamProxyInputStream.AbstractBuilder<T,B extends AbstractStreamBuilder<T, B>> 
- 
Field SummaryFields inherited from class java.io.FilterInputStreamin
- 
Constructor SummaryConstructorsConstructorDescriptionConstructs a SwappedDataInputStream.
- 
Method SummaryModifier and TypeMethodDescriptionbooleanReturnreadByte()!bytereadByte()Invokes the delegate'sread()method.charreadChar()Reads a 2 byte, unsigned, little endian UTF-16 code point.doubleReads an 8 byte, two's complement, little-endian long.floatReads a 4 byte, IEEE 754, little-endian float.voidreadFully(byte[] data) Invokes the delegate'sread(byte[] data, int, int)method.voidreadFully(byte[] data, int offset, int length) Invokes the delegate'sread(byte[] data, int, int)method.intreadInt()Reads a 4 byte, two's complement little-endian integer.readLine()Not currently supported - throwsUnsupportedOperationException.longreadLong()Reads an 8 byte, two's complement little-endian integer.shortReads a 2 byte, two's complement, little-endian integer.intInvokes the delegate'sread()method.intReads a 2 byte, unsigned, little-endian integer.readUTF()Not currently supported - throwsUnsupportedOperationException.intskipBytes(int count) Invokes the delegate'sskip(int)method.Methods inherited from class org.apache.commons.io.input.ProxyInputStreamafterRead, available, beforeRead, close, handleIOException, mark, markSupported, read, read, read, reset, setReference, skip, unwrap
- 
Constructor Details- 
SwappedDataInputStreamConstructs a SwappedDataInputStream.- Parameters:
- input- InputStream to read from
 
 
- 
- 
Method Details- 
readBooleanReturnreadByte()!= 0- Specified by:
- readBooleanin interface- DataInput
- Returns:
- false if the byte read is zero, otherwise true
- Throws:
- IOException- if an I/O error occurs.
- EOFException- if an end of file is reached unexpectedly
 
- 
readByteInvokes the delegate'sread()method.- Specified by:
- readBytein interface- DataInput
- Returns:
- the byte read or -1 if the end of stream
- Throws:
- IOException- if an I/O error occurs.
- EOFException- if an end of file is reached unexpectedly
 
- 
readCharReads a 2 byte, unsigned, little endian UTF-16 code point.- Specified by:
- readCharin interface- DataInput
- Returns:
- the UTF-16 code point read or -1 if the end of stream
- Throws:
- IOException- if an I/O error occurs.
- EOFException- if an end of file is reached unexpectedly
 
- 
readDoubleReads an 8 byte, two's complement, little-endian long.- Specified by:
- readDoublein interface- DataInput
- Returns:
- the read long
- Throws:
- IOException- if an I/O error occurs.
- EOFException- if an end of file is reached unexpectedly
 
- 
readFloatReads a 4 byte, IEEE 754, little-endian float.- Specified by:
- readFloatin interface- DataInput
- Returns:
- the read float
- Throws:
- IOException- if an I/O error occurs.
- EOFException- if an end of file is reached unexpectedly
 
- 
readFullyInvokes the delegate'sread(byte[] data, int, int)method.- Specified by:
- readFullyin interface- DataInput
- Parameters:
- data- the buffer to read the bytes into
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readFullyInvokes the delegate'sread(byte[] data, int, int)method.- Specified by:
- readFullyin interface- DataInput
- Parameters:
- data- the buffer to read the bytes into
- offset- The start offset
- length- The number of bytes to read
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readIntReads a 4 byte, two's complement little-endian integer.- Specified by:
- readIntin interface- DataInput
- Returns:
- the read int
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readLineNot currently supported - throwsUnsupportedOperationException.- Specified by:
- readLinein interface- DataInput
- Returns:
- the line read
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs
- UnsupportedOperationException- always
 
- 
readLongReads an 8 byte, two's complement little-endian integer.- Specified by:
- readLongin interface- DataInput
- Returns:
- the read long
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readShortReads a 2 byte, two's complement, little-endian integer.- Specified by:
- readShortin interface- DataInput
- Returns:
- the read short
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readUnsignedByteInvokes the delegate'sread()method.- Specified by:
- readUnsignedBytein interface- DataInput
- Returns:
- the byte read or -1 if the end of stream
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readUnsignedShortReads a 2 byte, unsigned, little-endian integer.- Specified by:
- readUnsignedShortin interface- DataInput
- Returns:
- the read short
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs.
 
- 
readUTFNot currently supported - throwsUnsupportedOperationException.- Specified by:
- readUTFin interface- DataInput
- Returns:
- never
- Throws:
- EOFException- if an end of file is reached unexpectedly
- IOException- if an I/O error occurs
- UnsupportedOperationException- always
 
- 
skipBytesInvokes the delegate'sskip(int)method.- Specified by:
- skipBytesin interface- DataInput
- Parameters:
- count- the number of bytes to skip
- Returns:
- the number of bytes skipped or -1 if the end of stream
- Throws:
- IOException- if an I/O error occurs
 
 
-