juan_gandhi: (VP)
[personal profile] juan_gandhi
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;
  }
}
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

June 2025

S M T W T F S
1 2345 6 7
8 9 10 11 121314
15161718 1920 21
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 22nd, 2025 10:34 am
Powered by Dreamwidth Studios