FileInputStream fileIn;
            FileOutputStream fileOut;
            File file=new File("D:/StreamContent.java");//任意文件路径
           
            byte[] c=new byte[2];
            c[0]=0x0d;
            c[1]=0x0a;//用于输入换行符的字节码
            String t=new String(c);//将该字节码转化为字符串类型
            String s="shskhdgkhskhgk;hdkshkg,";
            s+=t+"sdfsdf";
            buf=s.getBytes();//转换为Bit流
            fileIn=new FileInputStream(file);
                              
            count=buf.length;
            fileOut= new FileOutputStream("D:/FileOutputStreamTest.txt");//要写入的文件路径
            fileOut.write(buf,0,count);
            count=fileIn.read(buf);
            fileOut.write(buf,0,count); 

  

相关文章:

  • 2022-12-23
  • 2022-01-08
  • 2021-07-20
  • 2022-12-23
  • 2021-08-24
  • 2021-12-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案