Java InputStream to File inputStreamToFile(InputStream ins, File file)

Here you can find the source of inputStreamToFile(InputStream ins, File file)

Description

input Stream To File

License

Apache License

Declaration

public static void inputStreamToFile(InputStream ins, File file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.*;

public class Main {

    public static void inputStreamToFile(InputStream ins, File file) throws IOException {
        OutputStream os = new FileOutputStream(file);
        int bytesRead = 0;
        byte[] buffer = new byte[8192];
        while ((bytesRead = ins.read(buffer, 0, 8192)) != -1) {
            os.write(buffer, 0, bytesRead);
        }//from w  w w . ja va2s.co m
        os.close();
        ins.close();
    }
}

Related

  1. inputStream2File(InputStream in, File file)
  2. InputStream2File(InputStream in, String filePath)
  3. InputStreamToFile(final InputStream stream, final File file)
  4. inputStreamToFile(InputStream byteStream, String pathFileName)
  5. inputStreamToFile(InputStream in, File file)
  6. inputstreamtofile(InputStream ins, File file)
  7. inputStreamToFile(InputStream is)
  8. inputStreamToFile(InputStream is, File targetFile)
  9. inputStreamToFile(InputStream stream, File file)