代码
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();
}
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();
}
id 博主 = [[KILONET.CNBLOGS.COM alloc] initWithValue:@"天堂向右,我依然向左"
网名:@"老舟"
兴趣:@"影音,阅读"
动态:@"系统架构设计,Android通信模块开发"
网址:@"http://kilonet.cnblogs.com"
签名:@"--------------------------------------------------
Stay Hungry , Stay Foolish
求 知 若 渴,处 事 若 愚
--------------------------------------------------"
]; // Never Release