Here you can find the source of closeProcessStreams(Process p)
public static void closeProcessStreams(Process p)
//package com.java2s; /*//from w w w. j a va 2 s . co m * Copyright (C) 2015 University of Oregon * * You may distribute under the terms of either the GNU General Public * License or the Apache License, as specified in the README file. * * For more information, see the README file. */ import java.io.*; public class Main { public static void closeProcessStreams(Process p) { if (p != null) { closeQuietly(p.getOutputStream()); // process's STDIN [sic] closeQuietly(p.getInputStream()); // process's STDOUT [sic] closeQuietly(p.getErrorStream()); // process's STDERR } } public static void closeQuietly(Object obj) { if (obj != null) { if (obj instanceof Closeable) { try { ((Closeable) obj).close(); } catch (Exception e) { } } else { throw new ClassCastException("Not a closable Object"); } } } }