All About Class DataInputStream in Java

DataInputStream class lets an an application read primitive java data types from an underlying input stream in a machine dependent way.An application uses a data output stream to write data which can later read by a data input stream.Data input streams and data output streams represents Unicode Strings in a format that is a slight modification of UFT-8.
The null byte '\u0000' is encoded in a two byte format rather than one byte,so that the encoded Strings never have embedded null.Only one byte, two bytes and three bytes are used.

The class structure of the DataInputStream is given as:

public class extends implements{
public DataInputStream(InputStream in)
//Creates a new DataInputStream to read data from the specified input stream
public final int read(byte b[]);
public final int read(byte b[],int offSet,int length);
public final boolean readBoolean();
public final byte readByte();
public final char readChar();
public final double readDouble();
public final float readFloat();
public final void readFully(byte b[]);
public final void readFully(byte b[],int offSet,int length);
public final int readInt();
public final String readLine();
public final long readLong();
public final short readShort();
public final int readUnsignedByte();
public final int readUnsignedShort();
public final String readUTF();
public final int skipBytes(int n);
public final static String readUTF(DataInput in);
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class DataInputStream in Java All About Class DataInputStream in Java Reviewed by Animesh Chatterjee on October 09, 2018 Rating: 5

No comments:

Powered by Blogger.