public class ArrayInputAdapter extends java.lang.Object implements ArrayInput
ArrayInput
by wrapping DataInput
.
This adapter wraps a specified data input to provide methods for reading
values and arrays of values with an optionally specified byte order.
Byte order should rarely be specified. Most applications should simply use the default BIG_ENDIAN byte order.
When an adapter is constructed from an object that has a file channel, the channel enables more efficient reads of arrays of values.
Constructor and Description |
---|
ArrayInputAdapter(java.io.DataInput input)
Constructs an adapter for the specified data input.
|
ArrayInputAdapter(java.io.DataInput input,
java.nio.ByteOrder order)
Constructs an adapter for the specified data input and byte order.
|
ArrayInputAdapter(java.io.FileInputStream stream)
Constructs an adapter for the specified file input stream and byte order.
|
ArrayInputAdapter(java.io.FileInputStream stream,
java.nio.ByteOrder order)
Constructs an adapter for the specified file input stream and byte order.
|
ArrayInputAdapter(java.io.RandomAccessFile file)
Constructs an adapter for the specified random-access file.
|
ArrayInputAdapter(java.io.RandomAccessFile file,
java.nio.ByteOrder order)
Constructs an adapter for the specified random-access file and byte order.
|
ArrayInputAdapter(java.nio.channels.ReadableByteChannel channel,
java.io.DataInput input,
java.nio.ByteOrder order)
Constructs an adapter for the specified channel, input, and byte order.
|
Modifier and Type | Method and Description |
---|---|
java.nio.ByteOrder |
getByteOrder()
Gets the byte order for this adapter.
|
boolean |
readBoolean() |
byte |
readByte() |
void |
readBytes(byte[] v)
Reads byte elements into a specified array.
|
void |
readBytes(byte[][] v)
Reads byte elements into a specified array.
|
void |
readBytes(byte[][][] v)
Reads byte elements into a specified array.
|
void |
readBytes(byte[] v,
int k,
int n)
Reads byte elements into a specified array.
|
char |
readChar() |
void |
readChars(char[] v)
Reads char elements into a specified array.
|
void |
readChars(char[][] v)
Reads char elements into a specified array.
|
void |
readChars(char[][][] v)
Reads char elements into a specified array.
|
void |
readChars(char[] v,
int k,
int n)
Reads char elements into a specified array.
|
double |
readDouble() |
void |
readDoubles(double[] v)
Reads double elements into a specified array.
|
void |
readDoubles(double[][] v)
Reads double elements into a specified array.
|
void |
readDoubles(double[][][] v)
Reads double elements into a specified array.
|
void |
readDoubles(double[] v,
int k,
int n)
Reads double elements into a specified array.
|
float |
readFloat() |
void |
readFloats(float[] v)
Reads float elements into a specified array.
|
void |
readFloats(float[][] v)
Reads float elements into a specified array.
|
void |
readFloats(float[][][] v)
Reads float elements into a specified array.
|
void |
readFloats(float[] v,
int k,
int n)
Reads float elements into a specified array.
|
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
void |
readInts(int[] v)
Reads int elements into a specified array.
|
void |
readInts(int[][] v)
Reads int elements into a specified array.
|
void |
readInts(int[][][] v)
Reads int elements into a specified array.
|
void |
readInts(int[] v,
int k,
int n)
Reads int elements into a specified array.
|
java.lang.String |
readLine() |
long |
readLong() |
void |
readLongs(long[] v)
Reads long elements into a specified array.
|
void |
readLongs(long[][] v)
Reads long elements into a specified array.
|
void |
readLongs(long[][][] v)
Reads long elements into a specified array.
|
void |
readLongs(long[] v,
int k,
int n)
Reads long elements into a specified array.
|
short |
readShort() |
void |
readShorts(short[] v)
Reads short elements into a specified array.
|
void |
readShorts(short[][] v)
Reads short elements into a specified array.
|
void |
readShorts(short[][][] v)
Reads short elements into a specified array.
|
void |
readShorts(short[] v,
int k,
int n)
Reads short elements into a specified array.
|
int |
readUnsignedByte() |
int |
readUnsignedShort() |
java.lang.String |
readUTF() |
int |
skipBytes(int n) |
public ArrayInputAdapter(java.io.DataInput input)
input
- the data input.public ArrayInputAdapter(java.io.RandomAccessFile file)
file
- the random-access file.public ArrayInputAdapter(java.io.FileInputStream stream)
stream
- the file input stream.public ArrayInputAdapter(java.io.DataInput input, java.nio.ByteOrder order)
input
- the data input.order
- the byte order.public ArrayInputAdapter(java.io.RandomAccessFile file, java.nio.ByteOrder order)
file
- the random-access file.order
- the byte order.public ArrayInputAdapter(java.io.FileInputStream stream, java.nio.ByteOrder order)
stream
- the file input stream.order
- the byte order.public ArrayInputAdapter(java.nio.channels.ReadableByteChannel channel, java.io.DataInput input, java.nio.ByteOrder order)
channel
- the readable byte channel; null, if none.input
- the data input.order
- the byte order.public java.nio.ByteOrder getByteOrder()
public void readFully(byte[] b) throws java.io.IOException
readFully
in interface ArrayInput
readFully
in interface java.io.DataInput
java.io.IOException
public void readFully(byte[] b, int off, int len) throws java.io.IOException
readFully
in interface ArrayInput
readFully
in interface java.io.DataInput
java.io.IOException
public int skipBytes(int n) throws java.io.IOException
skipBytes
in interface ArrayInput
skipBytes
in interface java.io.DataInput
java.io.IOException
public final boolean readBoolean() throws java.io.IOException
readBoolean
in interface ArrayInput
readBoolean
in interface java.io.DataInput
java.io.IOException
public final byte readByte() throws java.io.IOException
readByte
in interface ArrayInput
readByte
in interface java.io.DataInput
java.io.IOException
public final int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface ArrayInput
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
public final short readShort() throws java.io.IOException
readShort
in interface ArrayInput
readShort
in interface java.io.DataInput
java.io.IOException
public final int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface ArrayInput
readUnsignedShort
in interface java.io.DataInput
java.io.IOException
public final char readChar() throws java.io.IOException
readChar
in interface ArrayInput
readChar
in interface java.io.DataInput
java.io.IOException
public final int readInt() throws java.io.IOException
readInt
in interface ArrayInput
readInt
in interface java.io.DataInput
java.io.IOException
public final long readLong() throws java.io.IOException
readLong
in interface ArrayInput
readLong
in interface java.io.DataInput
java.io.IOException
public final float readFloat() throws java.io.IOException
readFloat
in interface ArrayInput
readFloat
in interface java.io.DataInput
java.io.IOException
public final double readDouble() throws java.io.IOException
readDouble
in interface ArrayInput
readDouble
in interface java.io.DataInput
java.io.IOException
public final java.lang.String readLine() throws java.io.IOException
readLine
in interface ArrayInput
readLine
in interface java.io.DataInput
java.io.IOException
public final java.lang.String readUTF() throws java.io.IOException
readUTF
in interface ArrayInput
readUTF
in interface java.io.DataInput
java.io.IOException
public void readBytes(byte[] v, int k, int n) throws java.io.IOException
readBytes
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readBytes(byte[] v) throws java.io.IOException
readBytes
in interface ArrayInput
v
- the array.java.io.IOException
public void readBytes(byte[][] v) throws java.io.IOException
readBytes
in interface ArrayInput
v
- the array.java.io.IOException
public void readBytes(byte[][][] v) throws java.io.IOException
readBytes
in interface ArrayInput
v
- the array.java.io.IOException
public void readChars(char[] v, int k, int n) throws java.io.IOException
readChars
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readChars(char[] v) throws java.io.IOException
readChars
in interface ArrayInput
v
- the array.java.io.IOException
public void readChars(char[][] v) throws java.io.IOException
readChars
in interface ArrayInput
v
- the array.java.io.IOException
public void readChars(char[][][] v) throws java.io.IOException
readChars
in interface ArrayInput
v
- the array.java.io.IOException
public void readShorts(short[] v, int k, int n) throws java.io.IOException
readShorts
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readShorts(short[] v) throws java.io.IOException
readShorts
in interface ArrayInput
v
- the array.java.io.IOException
public void readShorts(short[][] v) throws java.io.IOException
readShorts
in interface ArrayInput
v
- the array.java.io.IOException
public void readShorts(short[][][] v) throws java.io.IOException
readShorts
in interface ArrayInput
v
- the array.java.io.IOException
public void readInts(int[] v, int k, int n) throws java.io.IOException
readInts
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readInts(int[] v) throws java.io.IOException
readInts
in interface ArrayInput
v
- the array.java.io.IOException
public void readInts(int[][] v) throws java.io.IOException
readInts
in interface ArrayInput
v
- the array.java.io.IOException
public void readInts(int[][][] v) throws java.io.IOException
readInts
in interface ArrayInput
v
- the array.java.io.IOException
public void readLongs(long[] v, int k, int n) throws java.io.IOException
readLongs
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readLongs(long[] v) throws java.io.IOException
readLongs
in interface ArrayInput
v
- the array.java.io.IOException
public void readLongs(long[][] v) throws java.io.IOException
readLongs
in interface ArrayInput
v
- the array.java.io.IOException
public void readLongs(long[][][] v) throws java.io.IOException
readLongs
in interface ArrayInput
v
- the array.java.io.IOException
public void readFloats(float[] v, int k, int n) throws java.io.IOException
readFloats
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readFloats(float[] v) throws java.io.IOException
readFloats
in interface ArrayInput
v
- the array.java.io.IOException
public void readFloats(float[][] v) throws java.io.IOException
readFloats
in interface ArrayInput
v
- the array.java.io.IOException
public void readFloats(float[][][] v) throws java.io.IOException
readFloats
in interface ArrayInput
v
- the array.java.io.IOException
public void readDoubles(double[] v, int k, int n) throws java.io.IOException
readDoubles
in interface ArrayInput
v
- the array.k
- the index of the first element to read.n
- the number of elements to read.java.io.IOException
public void readDoubles(double[] v) throws java.io.IOException
readDoubles
in interface ArrayInput
v
- the array.java.io.IOException
public void readDoubles(double[][] v) throws java.io.IOException
readDoubles
in interface ArrayInput
v
- the array.java.io.IOException
public void readDoubles(double[][][] v) throws java.io.IOException
readDoubles
in interface ArrayInput
v
- the array.java.io.IOException