文件流

  文件流 

写入

  File file =new File(文件路径);

  FileOutPutStream fops=new FileOutPutStream((上面的file对象)file);

  fops.write("sssssss".getBytes(转为字节)); //主要用来写入音频 视屏等非字符的文件

  BufferOutPutStream bops=new BufferOutPutStream((前面的FileOutPutStream对象)fops);

  bops.write(“”.getBytes(转为字节));//主要用来写入音频 视屏等非字符的文件

 输出

  File file =new File(文件路径);

  InputStream is=new FileInnputStream(file);

  byte [] bs=new byte[1024];

  while((is.read(bs))!=-1){

String str=new String(bs);

System.out.prinln(str);

}

is.close();

posted @ 2021-12-24 16:59  左边第三只猫  阅读(68)  评论(0)    收藏  举报