Java Path File Write nio writeFully(Path filePath, byte[] bytes)

Here you can find the source of writeFully(Path filePath, byte[] bytes)

Description

write Fully

License

Apache License

Declaration

public static void writeFully(Path filePath, byte[] bytes) throws IOException 

Method Source Code


//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();
        }
    }
}

Related

  1. writeEndStringInFile(Path path, String s)
  2. writeFile(String filePath, String text)
  3. writeFile(String path, String output)
  4. writeFile(String payload, Path balOutPath)
  5. writeFileToArchive(final ZipOutputStream zos, final Path baseSrcPath, final Path filePath)
  6. writeJaasConfig(File krbDir, String princ, String keytabPath)
  7. writeJson(Object data, Path path)
  8. writeLastReadDate(String sinceDate, Path sinceFile)
  9. writeLines(Path path, T... a)