加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090321141152/http://developer.android.com:80/reference/java/io/DataInput.html
public interface

DataInput

java.io.DataInput
Known Indirect Subclasses

Class Overview

DataInput is an interface which declares methods for reading in typed data from a Stream. Typically, this stream has been written by a class which implements DataOutput. Types that can be read include byte, 16-bit short, 32-bit int, 32-bit float, 64-bit long, 64-bit double, byte strings, and UTF Strings.

Summary

Public Methods
abstract boolean readBoolean()
Reads a boolean from this stream.
abstract byte readByte()
Reads an 8-bit byte value from this stream.
abstract char readChar()
Reads a 16-bit character value from this stream.
abstract double readDouble()
Reads a 64-bit double value from this stream.
abstract float readFloat()
Reads a 32-bit float value from this stream.
abstract void readFully(byte[] buffer, int offset, int count)
Read bytes from this stream and stores them in byte array buffer starting at offset offset.
abstract void readFully(byte[] buffer)
Reads bytes from this stream into the byte array buffer.
abstract int readInt()
Reads a 32-bit integer value from this stream.
abstract String readLine()
Returns a String representing the next line of text available in this BufferedReader.
abstract long readLong()
Reads a 64-bit long value from this stream.
abstract short readShort()
Reads a 16-bit short value from this stream.
abstract String readUTF()
Reads a UTF format String from this Stream.
abstract int readUnsignedByte()
Reads an unsigned 8-bit byte value from this stream and returns it as an int.
abstract int readUnsignedShort()
Reads a 16-bit unsigned short value from this stream and returns it as an int.
abstract int skipBytes(int count)
Skips count number of bytes in this stream.

Public Methods

public abstract boolean readBoolean ()

Reads a boolean from this stream.

Returns
  • the next boolean value from the source stream.
Throws
IOException If a problem occurs reading from this stream.

public abstract byte readByte ()

Reads an 8-bit byte value from this stream.

Returns
  • the next byte value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract char readChar ()

Reads a 16-bit character value from this stream.

Returns
  • the next char value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract double readDouble ()

Reads a 64-bit double value from this stream.

Returns
  • the next double value from the source stream.
Throws
IOException If a problem occurs reading from this stream.

public abstract float readFloat ()

Reads a 32-bit float value from this stream.

Returns
  • the next float value from the source stream.
Throws
IOException If a problem occurs reading from this stream.

public abstract void readFully (byte[] buffer, int offset, int count)

Read bytes from this stream and stores them in byte array buffer starting at offset offset. This method blocks until count number of bytes have been read.

Parameters
buffer the byte array in which to store the read bytes.
offset the offset in buffer to store the read bytes.
count the maximum number of bytes to store in buffer.
Throws
IOException If a problem occurs reading from this stream.

public abstract void readFully (byte[] buffer)

Reads bytes from this stream into the byte array buffer. This method will block until buffer.length number of bytes have been read.

Parameters
buffer the buffer to read bytes into
Throws
IOException If a problem occurs reading from this stream.

public abstract int readInt ()

Reads a 32-bit integer value from this stream.

Returns
  • the next int value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract String readLine ()

Returns a String representing the next line of text available in this BufferedReader. A line is represented by 0 or more characters followed by '\n', '\r', "\n\r" or end of stream. The String does not include the newline sequence.

Returns
  • the contents of the line or null if no characters were read before end of stream.
Throws
IOException If a problem occurs reading from this stream.

public abstract long readLong ()

Reads a 64-bit long value from this stream.

Returns
  • the next long value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract short readShort ()

Reads a 16-bit short value from this stream.

Returns
  • the next short value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract String readUTF ()

Reads a UTF format String from this Stream.

Returns
  • the next UTF String from the source stream.
Throws
IOException If a problem occurs reading from this stream.

public abstract int readUnsignedByte ()

Reads an unsigned 8-bit byte value from this stream and returns it as an int.

Returns
  • the next unsigned byte value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract int readUnsignedShort ()

Reads a 16-bit unsigned short value from this stream and returns it as an int.

Returns
  • the next unsigned short value from the source stream.
Throws
IOException If a problem occurs reading from this stream.
See Also

public abstract int skipBytes (int count)

Skips count number of bytes in this stream. Subsequent read()'s will not return these bytes unless reset() is used.

Parameters
count the number of bytes to skip.
Returns
  • the number of bytes actually skipped.
Throws
IOException If a problem occurs reading from this stream.