代码
  android.util.Base64OutputStream stream;
  File file 
= new File(Environment.getExternalStorageDirectory()
    .getPath()
    
+ "/GooglePinyinInstaller.exe");
  
// 合并的文件
  File outFile = new File(Environment.getExternalStorageDirectory()
    .getPath()
    
+ "/GooglePinyinInstaller2.exe");

  
// 缓冲
  byte[] buffer = new byte[1024 * 1024];

  
try {
   
// 输入流
   ByteArrayOutputStream out = new ByteArrayOutputStream();
   stream 
= new Base64OutputStream(out, android.util.Base64.CRLF
     
| android.util.Base64.NO_CLOSE);

   
// 输出流写进文件
   
// RandomAccessFile outt = new RandomAccessFile(outFile, "rw");
   int off = 0;

   
// 循环读取输入流 begin
   InputStream inn = new FileInputStream(file);
   
   
while (inn.read(buffer) != -1) {
    Log.d(TAG, 
"****" + off++);

    
// 写入流
    stream.write(buffer);
    
//
    
    
// 写入文件
    
//outt.write(out.toByteArray());

    
// 循环读取输入流 end
   }
   
   System.out.println(
new String(out.toByteArray()));

   out.close();
   stream.close();
//   outt.close();

  } 
catch (FileNotFoundException e) {
   e.printStackTrace();
  } 
catch (IOException e) {
   e.printStackTrace();
  }

 

 

相关文章:

  • 2021-11-27
  • 2021-08-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-03
  • 2021-08-15
猜你喜欢
  • 2022-12-23
  • 2021-04-26
  • 2021-06-20
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案