DataInputStream ReadUTF() Example

returns a Unicode string.


DataInputStreamclass ReadUTF() method example. This example shows you how to use ReadUTF() method.This method returns a Unicode string.

Here is the code:-

/**
 * @Program that returns a Unicode string. 
 * ReadUTF.java 
 * Author:-RoseIndia Team
 * Date:-07-jun-2008
 */
import java.io.*;
public class ReadUTF {
public static void main(String[] args)throws IOException {
String lL = "Girish";
        FileOutputStream fos = new FileOutputStream("Linux.txt");
        DataOutputStream dos = new DataOutputStream(fos);
        dos.writeUTF(lL);
        dos.flush();
        dos.close();
        FileInputStream fis = new FileInputStream("Linux.txt");
        DataInputStream dis = new DataInputStream(fis);
           String l = dis.readUTF();
        System.out.println("The Unicode string is :" + l);
    }

}

Output of the Program
 The Unicode string is :Girish

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

HOME | COPYRIGHT | CONTACT US