FileUtils.writeByteArrayToFile(new File("pathname"), myByteArray)
或者,如果你坚持为自己工作...
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
}