Java tutorial
//package com.java2s; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; public class Main { public static OutputStream getOutputStream(File file) { try { OutputStream out = new BufferedOutputStream(new FileOutputStream(file)); return out; } catch (FileNotFoundException e) { e.printStackTrace(); } return null; } }