Java FileOutputStream Write Byte Array writeBytes(String filename, byte[] data, int len)

Here you can find the source of writeBytes(String filename, byte[] data, int len)

Description

write Bytes

License

GNU General Public License

Declaration

public static void writeBytes(String filename, byte[] data, int len) throws FileNotFoundException, IOException 

Method Source Code

//package com.java2s;
/*/*  w  w  w. j  av a2 s  . c  o m*/
 *                    BioJava development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU Lesser General Public Licence.  This should
 * be distributed with the code.  If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/copyleft/lesser.html
 *
 * Copyright for this code is held jointly by the individual
 * authors.  These should be listed in @author doc comments.
 *
 * For more information on the BioJava project and its aims,
 * or to join the biojava-l mailing list, visit the home page
 * at:
 *
 *      http://www.biojava.org/
 *
 * Created on Nov 4, 2016
 * Author: blivens 
 *
 */

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import java.io.IOException;

public class Main {
    public static void writeBytes(String filename, byte[] data) throws FileNotFoundException, IOException {
        writeBytes(filename, data, data.length);
    }

    public static void writeBytes(String filename, byte[] data, int len) throws FileNotFoundException, IOException {
        if (filename == null || filename.isEmpty()) {
            return;
        }
        try (FileOutputStream out = new FileOutputStream(filename)) {
            out.write(data, 0, len);
        }
    }
}

Related

  1. writeBytes(final File file, final byte[] bytes)
  2. writeBytes(final File file, final byte[] bytes)
  3. writeBytes(int[] data, String filename)
  4. writeBytes(int[] data, String filename)
  5. writeBytes(String filename, byte[] bytes)
  6. writeBytes(String filePath, boolean append, byte[] content)
  7. writeBytesInFile(File f, String data)
  8. writeBytesSafely(File aFile, byte theBytes[])
  9. writeBytesToFile(byte[] bfile, String filePath, String fileName)