代码
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();
}