All About Class DataOutputStream in Java



DataOutputStream lets an application write primitive java data types to an output stream in a portable way.An application can then use a DataInputStream to read the data back.

The structure of class DataOutputStream is given as:

public class java.io.DataOutputStream extends java.io.FilterOutputStream implements java.io.DataOutput{
//Member element
protected int written;
//the number of bytes writes to the DataOutputStream
//constructor
public DataOutputStream(OutputStream out);
//Creates a new DataOutputStream to write data to the specified output stream
//methods:
public void flush();
public final int size();
public void write(byte b[],int offSet,int length);
public void write(int b);
public final void writeBoolean(boolean b);
public final void writeByte(int v);
public final void writeBytes(String str);
public final void writeChar(int v);
public final void writeChars(String s);
public final void writeDouble(double d);
public final void writeFloat(float f);
public final void writeInt(int v);
public final void writeLong(long l);
public final void writeShort(int i);
public final void writeUTF(string str);
 
In addition,all methods may throw an IOException if an IO error occurs apart from their regular Exceptions.
All About Class DataOutputStream in Java All About Class DataOutputStream in Java Reviewed by Animesh Chatterjee on October 09, 2018 Rating: 5

No comments:

Powered by Blogger.