A DataInputStream is not safe for use by multiple concurrent threads. If a DataInputStream is to be used by more than one thread then access to the data input stream should be controlled by appropriate synchronization.
java.io.DataOutputStream
Modifier and Type | Field and Description |
---|---|
private byte[] | bytearr
working arrays initialized on demand by readUTF |
private char[] | |
private static final byte[] | |
private static final char[] | |
private char[] | |
private final byte[] |
Access | Constructor and Description |
---|---|
public | DataInputStream(InputStream
the specified input stream in)Creates a DataInputStream that uses the specified underlying InputStream. |
Modifier and Type | Method and Description |
---|---|
public final int | Returns: the total number of bytes read into the buffer, or-1 if there is no more data because the end
of the stream has been reached.the buffer into which the data is read. b)Overrides java. Reads some number of bytes from the contained input stream and
stores them into the buffer array |
public final int | Returns: the total number of bytes read into the buffer, or-1 if there is no more data because the end
of the stream has been reached.the buffer into which the data is read. b, int the start offset in the destination array off, int b the maximum number of bytes read. len)Overrides java. Reads up to |
public final boolean | Returns: theboolean value read.Implements java. See the general contract of the |
public final byte | Returns: the next byte of this input stream as a signed 8-bitbyte .Implements java. See the general contract of the |
public final char | Returns: the next two bytes of this input stream, interpreted as achar .Implements java. See the general contract of the |
public final double | Returns: the next eight bytes of this input stream, interpreted as adouble .Implements java. See the general contract of the |
public final float | Returns: the next four bytes of this input stream, interpreted as afloat .Implements java. See the general contract of the |
public final void | readFully(byte[]
the buffer into which the data is read. b)Implements java. See the general contract of the |
public final void | readFully(byte[]
the buffer into which the data is read. b, int the start offset in the data array off, int b .the number of bytes to read. len)Implements java. See the general contract of the |
public final int | Returns: the next four bytes of this input stream, interpreted as anint .Implements java. See the general contract of the |
public final String | Returns: the next line of text from this input stream.Implements java.
Deprecated
This method does not properly convert bytes to characters.
See the general contract of the |
public final long | Returns: the next eight bytes of this input stream, interpreted as along .Implements java. See the general contract of the |
public final short | Returns: the next two bytes of this input stream, interpreted as a signed 16-bit number.Implements java. See the general contract of the |
public final int | Returns: the next byte of this input stream, interpreted as an unsigned 8-bit number.Implements java. See the general contract of the |
public final int | Returns: the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.Implements java. See the general contract of the |
public final String | Returns: a Unicode string.Implements java. See the general contract of the |
public static final String | Returns: a Unicode string.a data input stream. in)Reads from the
stream |
public final int | Returns: the actual number of bytes skipped.the number of bytes to be skipped. n)Implements java. See the general contract of the |
bytearr | back to summary |
---|---|
private byte[] bytearr working arrays initialized on demand by readUTF |
chararr | back to summary |
---|---|
private char[] chararr |
EMPTY_BYTE_ARRAY | back to summary |
---|---|
private static final byte[] EMPTY_BYTE_ARRAY |
EMPTY_CHAR_ARRAY | back to summary |
---|---|
private static final char[] EMPTY_CHAR_ARRAY |
lineBuffer | back to summary |
---|---|
private char[] lineBuffer |
readBuffer | back to summary |
---|---|
private final byte[] readBuffer |
DataInputStream | back to summary |
---|---|
public DataInputStream(InputStream in) Creates a DataInputStream that uses the specified underlying InputStream.
|
read | back to summary |
---|---|
public final int read(byte[] b) throws IOException Overrides java. Reads some number of bytes from the contained input stream and
stores them into the buffer array If The first byte read is stored into element The read(b, 0, b.length)
|
read | back to summary |
---|---|
public final int read(byte[] b, int off, int len) throws IOException Overrides java. Reads up to This method blocks until input data is available, end of file is detected, or an exception is thrown. If The first byte read is stored into element In every case, elements
|
readBoolean | back to summary |
---|---|
public final boolean readBoolean() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readByte | back to summary |
---|---|
public final byte readByte() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readChar | back to summary |
---|---|
public final char readChar() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readDouble | back to summary |
---|---|
public final double readDouble() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readFloat | back to summary |
---|---|
public final float readFloat() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readFully | back to summary |
---|---|
public final void readFully(byte[] b) throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readFully | back to summary |
---|---|
public final void readFully(byte[] b, int off, int len) throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readInt | back to summary |
---|---|
public final int readInt() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readLine | back to summary |
---|---|
public final String readLine() throws IOException Implements java. 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
with:DataInputStream d = new DataInputStream(in); BufferedReader d = new BufferedReader(new InputStreamReader(in)); See the general contract of the Bytes for this operation are read from the contained input stream.
|
readLong | back to summary |
---|---|
public final long readLong() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readShort | back to summary |
---|---|
public final short readShort() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readUnsignedByte | back to summary |
---|---|
public final int readUnsignedByte() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readUnsignedShort | back to summary |
---|---|
public final int readUnsignedShort() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readUTF | back to summary |
---|---|
public final String readUTF() throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|
readUTF | back to summary |
---|---|
public static final String readUTF(DataInput in) throws IOException Reads from the
stream
|
skipBytes | back to summary |
---|---|
public final int skipBytes(int n) throws IOException Implements java. See the general contract of the Bytes for this operation are read from the contained input stream.
|