Here you can find the source of writeFully(Path filePath, byte[] bytes)
public static void writeFully(Path filePath, byte[] bytes) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedOutputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.file.Path; public class Main { public static void writeFully(Path filePath, byte[] bytes) throws IOException { writeFully(new FileOutputStream(filePath.toFile()), bytes); }/*from www . ja v a 2s . c o m*/ public static void writeFully(OutputStream outputStream, byte[] bytes) throws IOException { try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(outputStream)) { bufferedOutputStream.write(bytes); bufferedOutputStream.flush(); } } }