字节IO流

// 字节流输入流
InputStream fil=new FileInputStream(“D:\mu\mu1\name.txt”);
byte[]by=new byte[100];
StringBuffer buf = null;
while(fil.read(by)!=-1){
String str=new String(by);
buf=new StringBuffer();
buf.append(str);
}
System.out.println(buf.toString());
fil.close();
//字节输出流

    OutputStream out=new FileOutputStream("D:\\mu\\mu1\\name.txt");

    String str="yaoxieruderenrong";
    byte[]byt=str.getBytes();
    out.write(byt);

猜你喜欢

转载自blog.csdn.net/Boxzhang/article/details/78892416