Here you can find the source of outStream(String file)
public static DataOutputStream outStream(String file)
//package com.java2s; //License from project: Open Source License import java.io.DataOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; public class Main { public static DataOutputStream outStream(String file) { return outStream(new File(file)); }//from ww w .j a va 2 s. co m public static DataOutputStream outStream(File file) { DataOutputStream out = null; try { out = new DataOutputStream(new FileOutputStream(file)); } catch (IOException err) { System.err.println(err.getMessage()); err.printStackTrace(); close(out); out = null; } return out; } public static void close(InputStream in) { try { if (in != null) { in.close(); } } catch (IOException err) { System.err.println(err.getMessage()); err.printStackTrace(); } } public static void close(OutputStream out) { try { if (out != null) { out.close(); } } catch (IOException err) { System.err.println(err.getMessage()); err.printStackTrace(); } } }