import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Scanner;
public class TryUTF {
/**
* @param args
* @throws IOException
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
FileInputStream fileIn = new FileInputStream("test.sf.txt");
final Scanner ina = new Scanner(fileIn);
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(
new FileOutputStream("Data.txt")));
while (ina.hasNext()) {
String str = ina.next();
out.writeUTF(str);
}
ina.close();
out.close();
DataInputStream in = new DataInputStream(new BufferedInputStream(
new FileInputStream("Data.txt")));
while (true) {
try {
System.out.println(in.readUTF());
} catch (IOException e) {
// e.printStackTrace();
break;
}
}
}
}