Java FileOutputStream Write save(String path, byte[] content, IProgressMonitor monitor)

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

Description

Saves a file.

License

Open Source License

Parameter

Parameter Description
path the file's path.
content the file's content.
monitor the progress monitor.

Exception

Parameter Description
IOException throw if an I/O error occurs.

Return

the saved file.

Declaration

public static void save(String path, byte[] content, IProgressMonitor monitor) throws IOException 

Method Source Code

//package com.java2s;
/**/*from  w w  w . j  av a2s . c o  m*/
 * This file is part of emf2gv : an eclipse plugin that allows to
 * generate a graphical representation of an EMF model.
 *
 * Copyright 2010-2011 Jean-Francois Brazeau
 * 
 * emf2gv is free software: you can redistribute it and/or modify
 * it under the terms of either:
 * 
 *      a) the GNU Lesser General Public License as published by
 *       the Free Software Foundation, either version 3 of the License, or
 *       (at your option) any later version.
 *  or
 *      b) the Eclipse Public License version 1.0 as published by
 *       the Eclipse Foundation.
 * 
 * emf2gv is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with emf2gv.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * You should have received a copy of the  Eclipse Public License
 * along with emf2gv.  If not, see <http://www.eclipse.org/legal/epl-v10.html>.
 */

import java.io.FileOutputStream;
import java.io.IOException;

import org.eclipse.core.runtime.IProgressMonitor;

public class Main {
    /**
     * Saves a file.
     * 
     * @param path
     *            the file's path.
     * @param content
     *            the file's content.
     * @param monitor
     *            the progress monitor.
     * @return the saved file.
     * @throws IOException
     *             throw if an I/O error occurs.
     */
    public static void save(String path, byte[] content, IProgressMonitor monitor) throws IOException {
        monitor.beginTask("Saving " + path, 1);
        FileOutputStream out = new FileOutputStream(path);
        out.write(content);
        out.flush();
        out.close();
    }
}

Related

  1. save(InputStream in, File f)
  2. save(String content, String fileName)
  3. save(String data, String encoding, String file)
  4. save(String f, byte[] data)
  5. save(String filename, byte[] bytes)
  6. saveArray(byte[] pictureBytes, OutputStream stream)
  7. saveBase64Str2Disk(String base64Str, File file)
  8. saveBase64strToFile(String base64Str, String filePath)
  9. saveBinaryFile(String fileName, byte[] buffer)