Name

java.io.DataInputStream

Synopsis

This class is a slightly smaller version of the J2SE DataInputStream class. The class can be used to read in primitive data types from a platform-dependent source. Most of the methods of this class read from the stream and return a Java primitive data type. Other important methods include available(), which returns the number of available bytes that can be read without blocking; the generic read() methods, which read in a specified amount of data, blocking if the data is not available yet. Also, skipBytes() skips over a number of bytes in the stream, blocking if the data is not yet available. Finally, readFully() reads the specified amount of data into a byte array.

public class DataInputStream extends java.io.InputStream
   implements java.io.DataInput {
   // protected fields
   protected InputStreamin;

   // constructor
   public DataInputStream(InputStream in);

   // static methods
   public static final String readUTF(DataInput in)
      throws java.io.IOException;

   // public instance methods
   public int available() throws java.io.IOException;
   public void close() throws java.io.IOException;
   public synchronized void mark(int readlimit);
   public boolean markSupported(); 
   public int read() throws java.io.IOException;
   public final int read(byte[] b) throws java.io.IOException;
   public final int read(byte[] b, int off, int len)
      throws java.io.IOException;
   public final boolean readBoolean() throws java.io.IOException;
   public final byte readByte() throws java.io.IOException; public ...

Get Wireless Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.