public final class Streams extends Object
Constructor and Description |
---|
Streams() |
Modifier and Type | Method and Description |
---|---|
static void |
close(Closeable... closables)
|
static String |
toBase64(byte[] bytes)
Encodes a raw byte array into a BASE64 string representation in accordance with RFC 2045.
|
static byte[] |
toByteArray(InputStream in)
Read the content of an input stream into a byte array.
|
static String |
toString(InputStream in,
String encoding)
Read the content of the specified input stream and returns the content as string using the specified encoding.
|
static long |
write(InputStream in,
OutputStream out)
Transfers all date from the given input stream to the given output stream and returns the number of transfered bytes.
|
@NotNull public static byte[] toByteArray(@NotNull InputStream in) throws IOException
in
- The input stream to read from.IOException
- If the first byte cannot be read for any reason other than the end of the file,if the input stream has been closed, or if some other I/O error occurs.@NotNull public static String toString(@NotNull InputStream in, @NotNull String encoding) throws IOException
in
- The input stream to read from.encoding
- The encoding to use for the string interpretation.IOException
- If the first byte cannot be read for any reason other than the end of the file,if the input stream has been closed, or if some other I/O error occurs.@NotNull public static String toBase64(@NotNull byte[] bytes)
bytes
- The bytes to convert. If length 0, "" will be returned.public static long write(@NotNull InputStream in, @NotNull OutputStream out) throws IOException
in
- The input stream to read from.out
- The ouput stream to write to.IOException
Copyright © 2021 e-Spirit AG. All Rights Reserved. Build 5.2.210210