try (FileOutputStream fos = new FileOutputStream("pathname")) {
fos.write(myByteArray);
//fos.close(); There is no more need for this line since you had created the instance of "fos" inside the try. And this will automatically close the OutputStream
}
1条答案
按热度按时间tjrkku2a1#
首先使用datainputstream发送文件名,然后接收文件。要将字节转换为文件,请执行以下操作:-
这是一个问题本身