    All Packages    This Package    Previous    Next

# Class java.io.DataInputStream

    java.lang.Object
       |
       +----java.io.InputStream
               |
               +----java.io.FilterInputStream
                       |
                       +----java.io.DataInputStream

public class DataInputStream
extends FilterInputStream

A data input stream that lets you read primitive Java data types from a stream in a portable way.

See Also:
  DataOutputStream
Version:
  1.16, 31 Jan 1995
Author:
  Arthur van Hoff

##

DataInputStream(InputStream)
  Create a new DataInputStream.

##

readBoolean()
  Reads a boolean.
readByte()
  Reads an 8 bit byte.
readBytes(byte[])
  Reads bytes, blocking until all bytes are read.
readBytes(byte[], int, int)
  Reads bytes, blocking until all bytes are read.
readChar()
  Reads a 16 bit char.
readDouble()
  Reads a 64 bit double.
readFloat()
  Reads a 32 bit float.
readInt()
  Reads a 32 bit int.
readLine()
  Reads a line terminated by a '\n' or EOF.
readLong()
  Reads a 64 bit long.
readShort()
  Reads 16 bit short.
readUTF()
  Reads a UTF format string.
skipBytes(int)
  Skips bytes, block until all bytes are skipped.

##

DataInputStream

      public DataInputStream(InputStream in)

  Create a new DataInputStream.
  Parameters:
    in - the input stream

##

readBytes

      public final int readBytes(byte b[])

  Reads bytes, blocking until all bytes are read.
  Parameters:
    b - the buffer into which the data is read
  Returns:
    the actual number of bytes read, -1 is returned when the end of the stream is reached.
  Throws: IOException
    i/o error occurred

readBytes

      public final int readBytes(byte b[],
                                 int off,
                                 int len)

  Reads bytes, blocking until all bytes are read.
  Parameters:
    b - the buffer into which the data is read
    off - the start offset of the data
    len - the maximum number of bytes read
  Returns:
    the actual number of bytes read, -1 is returned when the end of the stream is reached.
  Throws: IOException
    i/o error occurred

skipBytes

      public final int skipBytes(int n)

  Skips bytes, block until all bytes are skipped.
  Parameters:
    n - bytes to be skipped
  Returns:
    actual number of bytes skipped
  Throws: IOException
    i/o error occurred

readBoolean

      public final boolean readBoolean()

  Reads a boolean.

readByte

      public final byte readByte()

  Reads an 8 bit byte.

readShort

      public final short readShort()

  Reads 16 bit short.

readChar

      public final char readChar()

  Reads a 16 bit char.

readInt

      public final int readInt()

  Reads a 32 bit int.

readLong

      public final long readLong()

  Reads a 64 bit long.

readFloat

      public final float readFloat()

  Reads a 32 bit float.

readDouble

      public final double readDouble()

  Reads a 64 bit double.

readLine

      public final String readLine()

  Reads a line terminated by a '\n' or EOF.

readUTF

      public final String readUTF()

  Reads a UTF format string.

    All Packages    This Package    Previous    Next