All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.eurodyn.qlack.commons.fileio.FileWriter Maven / Gradle / Ivy

There is a newer version: 1.7.5
Show newest version
package com.eurodyn.qlack.commons.fileio;

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

/**
 * #### CONSIDER REPLACING THIS CLASS WITH APACHE COMMONS I/O #####
 *
 * @author European Dynamics SA
 */
public class FileWriter {

  private FileWriter() {

  }

  /**
   * Write a binary file.
   */
  public static void writeBinary(String filename, byte[] data)
      throws IOException {
    writeBinary(new File(filename), data);
  }

  /**
   * Write a binary file.
   */
  public static void writeBinary(File file, byte[] data) throws IOException {
    FileOutputStream fos = new FileOutputStream(file);

    try (BufferedOutputStream bos = new BufferedOutputStream(fos)) {
      bos.write(data);
    }
  }


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy