Java FileOutputStream Create writeFileRaw(String fileName, byte[][] contents)

Here you can find the source of writeFileRaw(String fileName, byte[][] contents)

Description

Method to write raw content to the file.

License

Open Source License

Parameter

Parameter Description
fileName name of the file (or path relative to directory)
contents an arrays of bytes and corresponding charsets.

Declaration

public static void writeFileRaw(String fileName, byte[][] contents) throws IOException 

Method Source Code

//package com.java2s;
/**//from   w  w  w . j  av a  2s .  c o m
 * Copyright (C) 2016 Netflix, Inc.
 *
 *     This file is part of IMF Conversion Utility.
 *
 *     IMF Conversion Utility is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     IMF Conversion Utility 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 General Public License for more details.
 *
 *     You should have received a copy of the GNU General Public License
 *     along with IMF Conversion Utility.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class Main {
    /**
     * Method to write raw content to the file.
     *
     * @param fileName name of the file (or path relative to directory)
     * @param contents an arrays of bytes and corresponding charsets.
     */
    public static void writeFileRaw(String fileName, byte[][] contents) throws IOException {
        try (OutputStream output = new BufferedOutputStream(new FileOutputStream(fileName))) {
            for (byte[] content : contents) {
                output.write(content);
            }
            output.flush();
        }
    }
}

Related

  1. writeFileData(File dataFile, String targetFile)
  2. writeFileData(File file, byte[] fileData)
  3. writeFileFromBytes(byte[] bytes, File file)
  4. writeFileFromStream(File tempFile, InputStream in)
  5. writeFileFromString(File outputFileName, String content)
  6. writeFileToByte(byte[] bytes, File file)
  7. writeFileToDisk(ByteArrayOutputStream is, String savePath)
  8. writeFileToDisk(File file, String targetPath)
  9. writeFileToFile(File inFile, File toFile)