Java FileOutputStream Write save(byte[] data, String path)

Here you can find the source of save(byte[] data, String path)

Description

save

License

BSD License

Declaration

private final static void save(byte[] data, String path) throws IOException 

Method Source Code


//package com.java2s;
//License from project: BSD License 

import java.io.IOException;

import java.io.FileOutputStream;
import java.io.File;

public class Main {
    private final static void save(byte[] data, String path) throws IOException {
        File f = new File(path);
        File p = f.getParentFile();
        if ((p != null) && (!p.isDirectory())) {
            p.mkdirs();//from ww  w  .j av a2s  .c o  m
        }
        FileOutputStream fout = new FileOutputStream(f);
        fout.write(data);
        fout.close();
    }
}

Related

  1. copyFileFromAssets(InputStream inputStream, String pathToWrite)
  2. copyFileUsingFileStreams(InputStream source, File dest)
  3. copyFileUsingStream(InputStream sourceStream, File dest)
  4. save(byte[] bs, String fn)
  5. save(byte[] bytes, File path)
  6. save(File file, byte[] bytes)
  7. save(File file, byte[] content)
  8. save(File file, byte[] content)
  9. save(File file, final byte[] encoded)