Java FileOutputStream write() Example

FileOutputStream class write() method example. This example shows you how to use write() method.


Syntax is : public void write(int b) throws IOException
Method writes the specified byte to this file output stream. Implements the write method of OutputStream.

Here is the code.
/**
 * @(#) Write2FileOutputStream.java
 * A class representing use of method write() of FileOutputStream 
 class in java.io Package.
 * @Version  05-June-2008
 @author   Rose India Team
 */
import java.io.*;
public class Write2FileOutputStream {
     public static void main(String[] argsthrows IOException {

     // Create object of FileOutputStream class
         FileOutputStream objFileStream = new FileOutputStream("MAHENDRA");
         
    // write() method call.
        objFileStream.write(65);
        System.out.print("Specified int value has written successfully to "
    "file output stream.");
    }   
}

output of the program.
Specified byte subarray has written successfully to file output stream.

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US