Write byte array to a file using FileOutputStream in Java
Description
The following code shows how to write byte array to a file using FileOutputStream.
Example
// w w w. j a v a 2 s. c o m
import java.io.FileOutputStream;
public class Main {
public static void main(String[] args) throws Exception {
String strFilePath = "test.txt";
FileOutputStream fos = new FileOutputStream(strFilePath);
String strContent = "Write File from java2s.com!";
fos.write(strContent.getBytes());
fos.close();
}
}