Build 1.0_r1(from source)

java.io
Interface DataInput

All Known Subinterfaces:
ObjectInput
All Known Implementing Classes:
DataInputStream, ObjectInputStream, RandomAccessFile

public interface DataInput

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.

See Also:
DataInputStream, RandomAccessFile

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

Method Detail

readBoolean

boolean readBoolean()
                    throws IOException
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.
See Also:
DataOutput.writeBoolean(boolean)

readByte

byte readByte()
              throws IOException
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:
DataOutput.writeByte(int)

readChar

char readChar()
              throws IOException
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:
DataOutput.writeChar(int)

readDouble

double readDouble()
                  throws IOException
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.
See Also:
DataOutput.writeDouble(double)

readFloat

float readFloat()
                throws IOException
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.
See Also:
DataOutput.writeFloat(float)

readFully

void readFully(byte[] buffer)
               throws IOException
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.
See Also:
DataOutput.write(byte[]), DataOutput.write(byte[], int, int)

readFully

void readFully(byte[] buffer,
               int offset,
               int count)
               throws IOException
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.
See Also:
DataOutput.write(byte[]), DataOutput.write(byte[], int, int)

readInt

int readInt()
            throws IOException
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:
DataOutput.writeInt(int)

readLine

String readLine()
                throws IOException
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.

readLong

long readLong()
              throws IOException
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:
DataOutput.writeLong(long)

readShort

short readShort()
                throws IOException
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:
DataOutput.writeShort(int)

readUnsignedByte

int readUnsignedByte()
                     throws IOException
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:
DataOutput.writeByte(int)

readUnsignedShort

int readUnsignedShort()
                      throws IOException
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:
DataOutput.writeShort(int)

readUTF

String readUTF()
               throws IOException
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.
See Also:
DataOutput.writeUTF(java.lang.String)

skipBytes

int skipBytes(int count)
              throws IOException
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.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature