Java FileOutputStream Write save(InputStream in, File f)

Here you can find the source of save(InputStream in, File f)

Description

save

License

Apache License

Declaration

public static void save(InputStream in, File f) throws IOException, Exception 

Method Source Code

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

import java.io.File;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

public class Main {
    public static void save(InputStream in, File f) throws IOException, Exception {
        FileOutputStream out = new FileOutputStream(f);
        try {//from  ww w.  ja  v  a  2 s.co m
            byte[] buffer = new byte[4 * 1024];
            int len = 0;
            while ((len = in.read(buffer)) != -1) {
                out.write(buffer, 0, len);
            }
        } finally {
            in.close();
            out.close();
        }
    }
}

Related

  1. save(File file, byte[] bytes)
  2. save(File file, byte[] content)
  3. save(File file, byte[] content)
  4. save(File file, final byte[] encoded)
  5. save(final InputStream in, final File file)
  6. save(String content, String fileName)
  7. save(String data, String encoding, String file)
  8. save(String f, byte[] data)
  9. save(String filename, byte[] bytes)