DataOutputStream WriteLong() Example

Writes a long to the underlying output stream as eight bytes, high byte first.


DataOutputStreamclass WriteLong() method example. This example shows you how to use WriteLong() method.This method Writes a long to the underlying output stream as eight bytes, high byte first.

Here is the code:-
/**
 * @Program that Writes a long to the underlying output stream as eight bytes,
    high byte first.
 * WriteLong.java 
 * Author:-RoseIndia Team
 * Date:-09-jun-2008
 */
import java.io.*;
public class WriteLong {
public static void main(String[] args)throws IOException {
long l=2324;
FileOutputStream fos=new FileOutputStream("g.txt");    
DataOutputStream dos=new DataOutputStream(fos);
//Writes a long to the underlying output stream as eight bytes,
dos.writeLong(l);
FileInputStream fis=new FileInputStream("g.txt");    
DataInputStream dis=new DataInputStream(fis);
System.out.println("Long to the underlying output stream is : "+dis.readLong());
    }

}

Output of the Program
 Long to the underlying output stream is : 2324

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

HOME | COPYRIGHT | CONTACT US