Package org.ocpsoft.common.util
Class Streams
java.lang.Object
org.ocpsoft.common.util.Streams
Utility methods for working with
InputStream and OutputStream instances.- Author:
- Lincoln Baxter, III
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcloseQuietly(Closeable source) Close the givenCloseablewithout throwing exceptions on failure.static booleancopy(InputStream input, OutputStream output) Copy all contents from theInputStreamto theOutputStream, using a buffer of size 2048.static booleancopy(InputStream input, OutputStream output, int bufferSize) Copy all contents from theInputStreamto theOutputStream, using a buffer of the given size.static InputStreamfromString(String data) Create anInputStreamfrom the givenString.static StringtoString(InputStream stream) Return aStringcontaining the contents of the givenInputStream
-
Constructor Details
-
Streams
public Streams()
-
-
Method Details
-
copy
Copy all contents from theInputStreamto theOutputStream, using a buffer of size 2048. -
copy
Copy all contents from theInputStreamto theOutputStream, using a buffer of the given size. -
toString
Return aStringcontaining the contents of the givenInputStream -
fromString
Create anInputStreamfrom the givenString. -
closeQuietly
Close the givenCloseablewithout throwing exceptions on failure.
-