Monday, June 1, 2015

FileOutputStream


FileOutputStream is used to create a file and write data into it.
The stream would create a file, if it doesn't already exist, before opening it for output.
Here are two constructors which can be used to create a FileOutputStream object.

OutputStream f = new FileOutputStream("C:/java/hello")
File f = new File("C:/java/hello");
OutputStream f = new FileOutputStream(f);

Methods:
public void close() throws IOException{}
protected void finalize()throws IOException {}
public void write(int w)throws IOException{}
public void write(byte[] w)

There are other important output streams available, for more detail you can refer to the following links:
  ByteArrayOutputStream
  DataOutputStream

No comments:

Post a Comment