Java FileOutputStream Write saveData(byte[] data, String PATH, String fileName)

Here you can find the source of saveData(byte[] data, String PATH, String fileName)

Description

save Data

License

Apache License

Declaration

public static boolean saveData(byte[] data, String PATH, String fileName) 

Method Source Code

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

import java.io.File;

import java.io.FileOutputStream;

public class Main {
    public static boolean saveData(byte[] data, String PATH, String fileName) {
        boolean ok = false;
        if (data != null) {
            try {
                FileOutputStream fos;
                File outputDir = new File(PATH);
                File saveFile = new File(outputDir, fileName);
                fos = new FileOutputStream(saveFile);
                fos.write(data);//  www .  ja  v  a 2  s.c o m
                fos.flush();
                fos.close();
                ok = true;
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return ok;
    }
}

Related

  1. saveBytesToFile(byte[] str, File file)
  2. saveBytesToFile(String filepath, byte[] data)
  3. saveCertReqToFile(String certReq, String fileLocation)
  4. saveColorTable(final float[][] table, final File file)
  5. saveContentToFile(DataHandler content, File outFile)
  6. saveDataToFile(String filePath, byte[] data)
  7. saveDownloadedFile(InputStream is, String destination)
  8. saveEntry(String destPath, ZipEntry target, ZipFile zf)
  9. saveFile(byte[] fileData, String outputDir, String fileName)