Java IO Tutorial - Java DataInputStream .readUTF (DataInput in)








Syntax

DataInputStream.readUTF(DataInput in) has the following syntax.

public static final String readUTF(DataInput in)    throws IOException

Example

In the following code shows how to use DataInputStream.readUTF(DataInput in) method.

// w  ww  .  j  av a 2s.co  m
import java.io.DataInput;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.InputStream;

public class Main {
  public static void main(String[] args) throws Exception {
    InputStream is = new FileInputStream("c:\\test.txt");

    DataInput in = new DataInputStream(is);
    DataInputStream.readUTF(in);

  }
}