0
点赞
收藏
分享

微信扫一扫

Java——>将一个字节型文件的内容写入另一个字节型文件

WikongGuan 2022-07-29 阅读 217


自己实现了一个方法,将绝对路径a下的文件的字节型内容写入绝对路径b下的文件中

public static void inputB(String a, String b){
FileInputStream fis = null;
FileOutputStream fos = null;
try {

fis = new FileInputStream(a);
fos = new FileOutputStream(b,true);
int code = fis.read();
while(code != -1){
fos.write(code);
code = fis.read();
}

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

try {
if(fis != null){
fis.close();
}

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

}

}


举报

相关推荐

0 条评论