public class StreamHelper extends Object
Temporary helper class that should be moved into the common library later.
Modifier and Type | Class and Description |
---|---|
static class |
StreamHelper.NullOutputStream |
Constructor and Description |
---|
StreamHelper() |
Modifier and Type | Method and Description |
---|---|
static String |
base64Encode(MessageDigest messageDigest)
Base64 encodes the digest (resets the digest).
|
static String |
base64EncodeMd5Digest(byte[] buffer)
Base64 encodes the given byte array after computing its MD5 digest.
|
static long |
copy(InputStream in,
OutputStream out)
Copy contents from the input stream into the output stream.
|
static DigestOutputStream |
createMd5MessageOutputStream(OutputStream stream)
Creates a DigestOutputStream where the digest uses MD5.
|
public static long copy(InputStream in, OutputStream out) throws IOException
Copy contents from the input stream into the output stream. The input stream will be closed in both successful or failure cases.
in
- The stream to copy.out
- The stream to write to.IOException
- if there were any issuespublic static String base64EncodeMd5Digest(byte[] buffer)
Base64 encodes the given byte array after computing its MD5 digest.
buffer
- The buffer to encodepublic static DigestOutputStream createMd5MessageOutputStream(OutputStream stream)
Creates a DigestOutputStream where the digest uses MD5.
stream
- The output stream to write to.public static String base64Encode(MessageDigest messageDigest)
Base64 encodes the digest (resets the digest).
messageDigest
- The digestCopyright © 2016–2024. All rights reserved.