|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.InputStream
jpl.mipl.io.vicar.VicarDataInputDIWrapper
public class VicarDataInputDIWrapper
VicarDataInputDIWrapper lets an application read primitive data types from a DataInput object; the data are converted (if necessary) from the int and real formats specified in the VicarDataFormat object that is passed in via the constructor.
This is exactly like VicarDataInputStream except the thing being wrapped
is a DataInput instead of a InputStream.
VicarDataInputStream| 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
|
| Constructor Summary | |
|---|---|
VicarDataInputDIWrapper(DataInput di_in,
int intFmtCode,
int realFmtCode)
Creates a new VicarDataInputDIWrapper to read data from the specified DataInput object. |
|
| Method Summary | |
|---|---|
int |
read()
Reads the next byte of data from this input stream. |
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. |
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.InputStream |
|---|
available, close, mark, markSupported, read, 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 VicarDataInputDIWrapper(DataInput di_in,
int intFmtCode,
int realFmtCode)
DataInput object.
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 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 int read()
throws IOException
read in class InputStreamIOException - if the DataInput doesInputStream.read()
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)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||