Java Utililty Methods Write Byte Array to File

List of utility methods to do Write Byte Array to File

Description

The list of methods to do Write Byte Array to File are organized into topic(s).

Method

voidwriteFile(String filename, byte[] bs)
write bytes to file
try {
    final File file = new File(filename).getParentFile();
    if (!file.exists()) {
        file.mkdirs();
    final FileOutputStream out = new FileOutputStream(filename);
    out.write(bs);
    out.flush();
...
voidwriteFile(String fileName, byte[] bytes)
write File
if (fileName != null) {
    FileOutputStream fileOutputStream = new FileOutputStream(fileName);
    fileOutputStream.write(bytes);
    fileOutputStream.flush();
    fileOutputStream.close();
voidwriteFile(String fileName, byte[] bytes)
write File
if (fileName.lastIndexOf("/") > 0)
    new File(fileName).getParentFile().mkdirs();
FileOutputStream fileOut = new FileOutputStream(fileName);
fileOut.write(bytes);
fileOut.close();
voidwriteFile(String fileName, byte[] bytes)
write File
File f = new File(fileName);
if (!f.exists()) {
    f.createNewFile();
} else {
    f.delete();
    f.createNewFile();
OutputStream os = new FileOutputStream(f);
...
voidwriteFile(String fileName, byte[] data)
write File
File file = new File(fileName);
FileOutputStream fs = new FileOutputStream(file);
fs.write(data);
fs.close();