package fileTest; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class DataStreamTest { static String file ="E;\\fileTest\\javase.txt"; public static void main(String[]args) throws IOException{ DataStreamTest.Data(); DataStreamTest.Datacopy(); } public static void Data() throws IOException{ DataOutputStream dos =new DataOutputStream(new FileOutputStream(file)); dos.writeInt(55); dos.writeUTF("中国"); dos.writeLong(11); dos.close(); } public static void Datacopy() throws IOException{ DataInputStream dis=new DataInputStream(new FileInputStream ("E;\\fileTest\\javac.txt")); int x=dis.readInt(); Long y=dis.readLong(); String z =dis.readUTF(); System.out.println("getInt:" +x); System.out.println("getLong:"+y); System.out.println("getString(utf);"+z); dis.close(); } }
就是那个字符UTF中国有问题,求帮助。。。
产品经理不是经理
相关分类