|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
jpl.mipl.io.vicar.VicarDataInputStream
public class VicarDataInputStream
VicarDataInputStream lets an application read primitive data types from an input stream; the data are converted (if necessary) from the int and real formats specified in the VicarDataFormat object that is passed in via the constructor.
| Field Summary | |
|---|---|
protected long[] |
_ieeeDouble
|
protected int[] |
_ieeeFloat
|
protected int |
_intFmtCode
|
protected long[] |
_rawDouble
|
protected int[] |
_rawFloat
|
protected int |
_realFmtCode
|
protected long[] |
_vaxDouble
|
protected int[] |
_vaxFloat
|
| Fields inherited from class java.io.FilterInputStream |
|---|
in |
| Constructor Summary | |
|---|---|
VicarDataInputStream(InputStream in,
int intFmtCode,
int realFmtCode)
Creates a new VicarDataInputStream to read data from the specified input stream. |
|
| Method Summary | |
|---|---|
int |
read(byte[] b)
Reads up to byte.length bytes of data from this
input stream into an array of bytes. |
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this input
stream into an array of bytes. |
boolean |
readBoolean()
Reads a boolean from this data input stream. |
byte |
readByte()
Reads a signed 8-bit value from this data input stream. |
char |
readChar()
Reads a Unicode character from this data input stream. |
double |
readDouble()
Reads a double from this data input stream. |
float |
readFloat()
Reads a float from this data input stream. |
void |
readFully(byte[] b)
Reads b.length bytes from this data input stream
into the byte array. |
void |
readFully(byte[] b,
int off,
int len)
Reads exactly len bytes from this data input stream
into the byte array. |
int |
readInt()
Reads a signed 32-bit integer from this input stream. |
String |
readLine()
Deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the
DataInputStream class to read lines can be converted to use
the BufferedReader class by replacing code of the form
DataInputStream d = new DataInputStream(in);
BufferedReader d
= new BufferedReader(new InputStreamReader(in));
|
long |
readLong()
Reads a signed 64-bit integer from this data input stream. |
short |
readShort()
Reads a signed 16-bit number from this data input stream. |
int |
readUnsignedByte()
Reads an unsigned 8-bit number from this data input stream. |
int |
readUnsignedShort()
Reads an unsigned 16-bit number from this data input stream. |
String |
readUTF()
Reads in a string that has been encoded using a modified UTF-8 format from this data input stream. |
static String |
readUTF(DataInput in)
Reads in a string from the specified data input stream. |
protected long[] |
shift_right_3(long[] y,
long[] x)
|
protected int[] |
shift_right(int[] x)
|
int |
skipBytes(int n)
Skips exactly n bytes of input in the underlying
input stream. |
| Methods inherited from class java.io.FilterInputStream |
|---|
available, close, mark, markSupported, read, reset, skip |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _intFmtCode
protected int _realFmtCode
protected int[] _rawFloat
protected int[] _vaxFloat
protected int[] _ieeeFloat
protected long[] _rawDouble
protected long[] _vaxDouble
protected long[] _ieeeDouble
| Constructor Detail |
|---|
public VicarDataInputStream(InputStream in,
int intFmtCode,
int realFmtCode)
in - the input stream you`re wrappingformat - the data format to convert *from*| Method Detail |
|---|
public short readShort()
throws IOException
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
readShort in interface DataInputEOFException - if this input stream reaches the end before
reading two bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public int readUnsignedShort()
throws IOException
This method blocks until the two bytes are read, the end of the stream is detected, or an exception is thrown.
readUnsignedShort in interface DataInputEOFException - if this input stream reaches the end before
reading two bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public int readInt()
throws IOException
This method blocks until the four bytes are read, the end of the stream is detected, or an exception is thrown.
readInt in interface DataInputint.
EOFException - if this input stream reaches the end before
reading four bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public long readLong()
throws IOException
This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.
readLong in interface DataInputlong.
EOFException - if this input stream reaches the end before
reading eight bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public float readFloat()
throws IOException
float from this data input stream. This
method reads an int value as if by the
readInt method and then converts that
int to a float using the
intBitsToFloat method in class Float.
This method blocks until the four bytes are read, the end of the
stream is detected, or an exception is thrown.
readFloat in interface DataInputfloat.
EOFException - if this input stream reaches the end before
reading four bytes.
IOException - if an I/O error occurs.DataInputStream.readInt(),
Float.intBitsToFloat(int)protected int[] shift_right(int[] x)
protected long[] shift_right_3(long[] y,
long[] x)
public double readDouble()
throws IOException
double from this data input stream. This
method reads a long value as if by the
readLong method and then converts that
long to a double using the
longBitsToDouble method in class Double.
This method blocks until the eight bytes are read, the end of the stream is detected, or an exception is thrown.
readDouble in interface DataInputdouble.
EOFException - if this input stream reaches the end before
reading eight bytes.
IOException - if an I/O error occurs.DataInputStream.readLong(),
Double.longBitsToDouble(long)
public final int read(byte[] b)
throws IOException
byte.length bytes of data from this
input stream into an array of bytes. This method blocks until some
input is available.
The read method of DataInputStream
calls the read method of its underlying input stream
with the three arguments b, 0, and
b.length and returns whatever value that method returns.
read in class FilterInputStreamb - the buffer into which the data is read.
-1 if there is no more data because the end
of the stream has been reached.
IOException - if an I/O error occurs.FilterInputStream.in,
InputStream.read(byte[], int, int)
public final int read(byte[] b,
int off,
int len)
throws IOException
len bytes of data from this input
stream into an array of bytes. This method blocks until some input
is available.
The read method of DataInputStream
calls the read method of its underlying input stream
with the same arguments and returns whatever value that method returns.
read in class FilterInputStreamb - the buffer into which the data is read.off - the start offset of the data.len - the maximum number of bytes read.
-1 if there is no more data because the end
of the stream has been reached.
IOException - if an I/O error occurs.FilterInputStream.in,
InputStream.read(byte[], int, int)
public final void readFully(byte[] b)
throws IOException
b.length bytes from this data input stream
into the byte array. This method reads repeatedly from the
underlying stream until all the bytes are read. This method blocks
until all the bytes are read, the end of the stream is detected,
or an exception is thrown.
readFully in interface DataInputb - the buffer into which the data is read.
EOFException - if this input stream reaches the end before
reading all the bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public final void readFully(byte[] b,
int off,
int len)
throws IOException
len bytes from this data input stream
into the byte array. This method reads repeatedly from the
underlying stream until all the bytes are read. This method blocks
until all the bytes are read, the end of the stream is detected,
or an exception is thrown.
readFully in interface DataInputb - the buffer into which the data is read.off - the start offset of the data.len - the number of bytes to read.
EOFException - if this input stream reaches the end before
reading all the bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public final int skipBytes(int n)
throws IOException
n bytes of input in the underlying
input stream. This method blocks until all the bytes are skipped,
the end of the stream is detected, or an exception is thrown.
skipBytes in interface DataInputn - the number of bytes to be skipped.
n.
EOFException - if this input stream reaches the end before
skipping all the bytes.
IOException - if an I/O error occurs.
public final boolean readBoolean()
throws IOException
boolean from this data input stream. This
method reads a single byte from the underlying input stream. A
value of 0 represents false. Any other
value represents true. This method blocks until
either the byte is read, the end of the stream is detected, or an
exception is thrown.
readBoolean in interface DataInputboolean value read.
EOFException - if this input stream has reached the end.
IOException - if an I/O error occurs.FilterInputStream.in
public final byte readByte()
throws IOException
b, where
0 <= b <= 255, then the
result is:
(byte)(b)
This method blocks until either the byte is read, the end of the stream is detected, or an exception is thrown.
readByte in interface DataInputbyte.
EOFException - if this input stream has reached the end.
IOException - if an I/O error occurs.FilterInputStream.in
public final int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputEOFException - if this input stream has reached the end.
IOException - if an I/O error occurs.FilterInputStream.in
public final char readChar()
throws IOException
b1 and b2,
where 0 <= b1,
b1 <= 255, then the result is equal to:
(char)((b1 << 8) | b2)
This method blocks until either the two bytes are read, the end of the stream is detected, or an exception is thrown.
readChar in interface DataInputEOFException - if this input stream reaches the end before
reading two bytes.
IOException - if an I/O error occurs.FilterInputStream.in
public final String readLine()
throws IOException
BufferedReader.readLine() method. Programs that use the
DataInputStream class to read lines can be converted to use
the BufferedReader class by replacing code of the form
DataInputStream d = new DataInputStream(in);
BufferedReader d
= new BufferedReader(new InputStreamReader(in));
A line of text is terminated by a carriage return character
('\r'), a newline character ('\n'), a
carriage return character immediately followed by a newline
character, or the end of the input stream. The line-terminating
character(s), if any, are not returned as part of the string that
is returned.
This method blocks until a newline character is read, a carriage return and the byte following it are read (to see if it is a newline), the end of the stream is detected, or an exception is thrown.
readLine in interface DataInputIOException - if an I/O error occurs.BufferedReader.readLine(),
FilterInputStream.in
public final String readUTF()
throws IOException
readUTF(this).
See readUTF(java.io.DataInput) for a more
complete description of the format.
This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.
readUTF in interface DataInputEOFException - if this input stream reaches the end before
reading all the bytes.
IOException - if an I/O error occurs.DataInputStream.readUTF(java.io.DataInput)
public static final String readUTF(DataInput in)
throws IOException
The first two bytes are read as if by
readUnsignedShort. This value gives the number of
following bytes that are in the encoded string, not
the length of the resulting string. The following bytes are then
interpreted as bytes encoding characters in the UTF-8 format
and are converted into characters.
This method blocks until all the bytes are read, the end of the stream is detected, or an exception is thrown.
in - a data input stream.
EOFException - if the input stream reaches the end
before all the bytes.
IOException - if an I/O error occurs.
UTFDataFormatException - if the bytes do not represent a
valid UTF-8 encoding of a Unicode string.DataInputStream.readUnsignedShort()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||