OCPsoft Common API 1.0.5.Final

org.ocpsoft.common.util
Class Streams

java.lang.Object
  extended by org.ocpsoft.common.util.Streams

public final class Streams
extends Object

Utility methods for working with InputStream and OutputStream instances.

Author:
Lincoln Baxter, III

Constructor Summary
Streams()
           
 
Method Summary
static void closeQuietly(Closeable source)
          Close the given Closeable without throwing exceptions on failure.
static boolean copy(InputStream input, OutputStream output)
          Copy all contents from the InputStream to the OutputStream, using a buffer of size 2048.
static boolean copy(InputStream input, OutputStream output, int bufferSize)
          Copy all contents from the InputStream to the OutputStream, using a buffer of the given size.
static InputStream fromString(String data)
          Create an InputStream from the given String.
static String toString(InputStream stream)
          Return a String containing the contents of the given InputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Streams

public Streams()
Method Detail

copy

public static boolean copy(InputStream input,
                           OutputStream output)
Copy all contents from the InputStream to the OutputStream, using a buffer of size 2048.


copy

public static boolean copy(InputStream input,
                           OutputStream output,
                           int bufferSize)
Copy all contents from the InputStream to the OutputStream, using a buffer of the given size.


toString

public static String toString(InputStream stream)
Return a String containing the contents of the given InputStream


fromString

public static InputStream fromString(String data)
Create an InputStream from the given String.


closeQuietly

public static void closeQuietly(Closeable source)
Close the given Closeable without throwing exceptions on failure.


OCPsoft Common API 1.0.5.Final

Copyright © 2012 OCPsoft. All Rights Reserved.