Java FileOutputStream Create writeFile(InputStream is, File file)

Here you can find the source of writeFile(InputStream is, File file)

Description

write File

License

Open Source License

Declaration

private static void writeFile(InputStream is, File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

public class Main {
    private static void writeFile(InputStream is, File file) throws IOException {
        file.getParentFile().mkdirs();/*www  .  j av  a  2  s .co  m*/
        try (FileOutputStream fos = new FileOutputStream(file)) {
            final byte data[] = new byte[1024];
            int count;
            while ((count = is.read(data, 0, 1024)) != -1) {
                fos.write(data, 0, count);
            }
        }
    }
}

Related

  1. writeFile(final String filename, final byte[] data)
  2. writeFile(final String fileNamePath, final byte[] daten)
  3. writeFile(InputStream in, File file)
  4. writeFile(InputStream inputFile, String path, String fullFileName)
  5. writeFile(InputStream inputStream, String filename, long lastModified)
  6. writeFile(InputStream is, File outFile)
  7. writeFile(InputStream srcStream, File destFile)
  8. writeFile(InputStream stream, File to)
  9. writeFile(List data, String filename)