Class StreamUtils
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.StreamUtils
-
public final class StreamUtils extends Object
Simple utility methods for dealing with streams.- Since:
- 4.0.0
- Author:
- Dmytro Nosan
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidcopy(InputStream inputStream, OutputStream outputStream)Copy the contents of the provided InputStream to the provided OutputStream.static byte[]toByteArray(InputStream inputStream)Copy the contents of the provided InputStream into a byte array.static StringtoString(InputStream inputStream, Charset charset)Copy the contents of the provided InputStream into a String.
-
-
-
Method Detail
-
toString
public static String toString(InputStream inputStream, Charset charset) throws IOException
Copy the contents of the provided InputStream into a String.Note! InputStream will not be closed.
- Parameters:
inputStream- the InputStream to copy fromcharset- A charset- Returns:
- the String
- Throws:
IOException- inputStream case of I/O errors
-
toByteArray
public static byte[] toByteArray(InputStream inputStream) throws IOException
Copy the contents of the provided InputStream into a byte array.Note! InputStream will not be closed.
- Parameters:
inputStream- the InputStream to copy from- Returns:
- the byte array
- Throws:
IOException- inputStream case of I/O errors
-
copy
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException
Copy the contents of the provided InputStream to the provided OutputStream.Note! InputStream and OutputStream will not be closed.
- Parameters:
inputStream- the InputStream to copy fromoutputStream- the OutputStream to copy to- Throws:
IOException- inputStream case of I/O errors
-
-