Java InputStream to File writeStreamToFile(InputStream in, OutputStream out)

Here you can find the source of writeStreamToFile(InputStream in, OutputStream out)

Description

write Stream To File

License

Open Source License

Declaration

public static void writeStreamToFile(InputStream in, OutputStream out) throws IOException 

Method Source Code


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

import java.io.*;

public class Main {
    public static void writeStreamToFile(InputStream in, OutputStream out) throws IOException {
        byte[] buffer = new byte[16384];
        while (true) {
            int count = in.read(buffer);
            if (count < 0)
                break;
            out.write(buffer, 0, count);
        }//from w ww  . jav  a  2 s.  c  o m
        in.close();
        out.close();
    }
}

Related

  1. inputStreamToFile(InputStream is)
  2. inputStreamToFile(InputStream is, File targetFile)
  3. inputStreamToFile(InputStream stream, File file)
  4. writeStreamToFile(File target, InputStream in)
  5. writeStreamToFile(InputStream _actual, File _file)
  6. writeStreamToFile(InputStream in, String fileName)
  7. writeStreamToFile(InputStream inputStream, File file)
  8. writeStreamToFile(InputStream inputStream, File targetFile)
  9. writeStreamToFile(InputStream inputStream, String extension)