|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.InputStream java.io.FilterInputStream ca.idms.io.NativeDataInputStream
public class NativeDataInputStream
A NativeDataInputStream reads "native" data from a buffered input stream.
This class combines a DataInputStream, a NativeFormat, and a
TraceBufferInputStream, and provides additional features to
those defined by the DataInput interface:
final
, so this
class can be a base class for specialized data input classes.
TraceBufferInputStream
,
NativeFormat
,
LoDataInputStream
,
FloDataInputStream
,
UtfDataInputStream
,
UnicodeDataInputStream
Field Summary | |
---|---|
protected java.io.DataInputStream |
dis
Contains the default methods. |
protected NativeFormat |
fmt
Describes the native data formats. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Method Summary | |
---|---|
byte[] |
getBuffer()
Gets a reference to the buffer. |
int |
getCount()
Gets the number of valid bytes in the buffer. |
NativeFormat |
getFormat()
Gets the data formats in effect for this stream. |
int |
getPosition()
Gets the index of the next character to be read. |
boolean |
readBoolean()
Reads a boolean from the data input stream. |
byte |
readByte()
Reads a signed 8-bit value from the data input stream. |
java.lang.String |
readBytes(int len)
Reads a string from a stream as an array of bytes. |
java.lang.String |
readBytesInternal(int len)
Reads an internal control block string from a stream as an array of bytes. |
java.lang.String |
readBytesKatakana(int len)
Reads a single byte Katakana string from a stream as an array of bytes. |
char |
readChar()
Reads a Unicode character from the underlying input stream, by calling the DataInputStream readChar method. |
double |
readDouble()
Reads a double from the data input stream. |
float |
readFloat()
Reads a float from the data input stream. |
void |
readFully(byte[] b)
Reads b.length bytes from the data input stream. |
void |
readFully(byte[] b,
int off,
int len)
Reads exactly len bytes from the data input stream. |
java.lang.String |
readGraphic(int len)
Reads OS/390 DBCS data into String. |
int |
readInt()
Reads an int from the data input stream. |
java.lang.String |
readLine()
Deprecated. But specified by the DataInput interface. |
long |
readLong()
Reads a long from the data input stream. |
java.math.BigDecimal |
readPacked(int prec,
int scale)
Reads a native format PACKED DECIMAL into a BigDecimal. |
short |
readShort()
Reads a short from the data input stream. |
int |
readUnsignedByte()
Reads an unsigned 8-bit number from the underlying data input stream. |
int |
readUnsignedShort()
Reads an unsigned short from the data input stream. |
java.lang.String |
readUTF()
Reads a string that has been encoded using a modified UTF-8 format from the data input stream. |
java.math.BigDecimal |
readZoned(int prec,
int scale)
Reads a Native format ZONED DECIMAL into a BigDecimal. |
void |
setSize(int len)
Sets the size of the buffer. |
int |
skipBytes(int n)
Skips exactly n bytes of input in the data input stream. |
void |
snap()
Displays the contents of this buffer if tracing is enabled. |
protected java.math.BigDecimal |
toBigDecimal(char[] c,
int scale)
Creates a BigDecimal object from a "numeric" character array. |
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 |
Field Detail |
---|
protected java.io.DataInputStream dis
protected NativeFormat fmt
Method Detail |
---|
public void setSize(int len)
public NativeFormat getFormat()
public byte[] getBuffer()
public int getCount()
public int getPosition()
public void snap()
Enabled by TraceObject.trace and TraceObject.snapBytes.
TraceObject
public void readFully(byte[] b) throws java.io.IOException
readFully
in interface java.io.DataInput
b
- the buffer into which the data is read.
java.io.IOException
public void readFully(byte[] b, int off, int len) throws java.io.IOException
readFully
in interface java.io.DataInput
b
- the buffer into which the data is read.off
- the start offset of the data.len
- the number of bytes to read.
java.io.IOException
public int skipBytes(int n) throws java.io.IOException
skipBytes
in interface java.io.DataInput
n
- the number of bytes to be skipped.
n
.
java.io.IOException
public boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.EOFException
- if this input stream has reached the end.
java.io.IOException
- if an I/O error occurs.public byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
public int readUnsignedByte() throws java.io.IOException
readUnsignedByte
in interface java.io.DataInput
java.io.IOException
public short readShort() throws java.io.IOException
readShort
in interface java.io.DataInput
java.io.EOFException
- if this input stream reaches
the end before reading two bytes.
java.io.IOException
- if an I/O error occurs.public int readUnsignedShort() throws java.io.IOException
readUnsignedShort
in interface java.io.DataInput
java.io.EOFException
- if this input stream reaches
the end before reading two bytes.
java.io.IOException
- if an I/O error occurs.public char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.EOFException
- if this input stream reaches the end
before reading two bytes.
java.io.IOException
- if an I/O error occurs.public int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
java.io.EOFException
- if this input stream reaches the end before
reading four bytes.
java.io.IOException
- if an I/O error occurs.public long readLong() throws java.io.IOException
readLong
in interface java.io.DataInput
java.io.EOFException
- if this input stream reaches the end before
java.io.reading eight bytes.
java.io.IOException
- if an I/O error occurs.public float readFloat() throws java.io.IOException
readFloat
in interface java.io.DataInput
java.io.IOException
readInt()
public double readDouble() throws java.io.IOException
readDouble
in interface java.io.DataInput
java.io.IOException
readLong()
public java.lang.String readLine() throws java.io.IOException
readLine
in interface java.io.DataInput
java.io.IOException
- always, don't call itpublic java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
public java.lang.String readBytes(int len) throws java.io.UnsupportedEncodingException, java.io.IOException
len
- number of bytes to read from stream
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursNativeDataOutputStream.writeBytes(String, int)
public java.lang.String readBytesKatakana(int len) throws java.io.UnsupportedEncodingException, java.io.IOException
len
- number of bytes to read from stream
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occurspublic java.lang.String readBytesInternal(int len) throws java.io.UnsupportedEncodingException, java.io.IOException
len
- number of bytes to read from stream
java.io.UnsupportedEncodingException
- if the
character set encoding is not supported
java.io.IOException
- if an IO error occursNativeDataOutputStream.writeBytesInternal(String, int)
public java.math.BigDecimal readPacked(int prec, int scale) throws java.io.IOException
prec
- total number of digitsscale
- number of digits after the decimal
java.io.IOException
- if any errortoBigDecimal(char[], int)
public java.math.BigDecimal readZoned(int prec, int scale) throws java.io.IOException
prec
- total number of digitsscale
- number of digits after the decimal
java.io.IOException
- if any errortoBigDecimal(char[], int)
protected java.math.BigDecimal toBigDecimal(char[] c, int scale) throws DecimalFormatException
c
- an array of "numeric" characters.scale
- number of digits after the decimal.
DecimalFormatException
- if invalidreadPacked(int, int)
,
readZoned(int, int)
public java.lang.String readGraphic(int len) throws java.io.IOException
len
- the number of DBCS characters to read
java.io.IOException
- if an IO error occursreadBytes(int)
,
UtfDataInputStream.readBytes(int)
,
UnicodeDataInputStream.readBytes(int)
,
NativeFormat.getString(byte[])
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |