more Java masterpieces
Oct. 20th, 2013 09:07 am![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
public class Streams { /** * Drains the contents of a stream without blocking on further input from that stream. * * @param stream the stream to drain * @return the contents of the drained stream */ public static String drainStream(OutputStream stream) { if (stream == null) { return null; } if (stream instanceof CircularOutputStream) { return stream.toString(); } return null; } }