@HashCodeAndEqualsPlugin.Enhance public class StreamDrainer extends Object
InputStream into a byte array.| Modifier and Type | Field and Description |
|---|---|
static StreamDrainer |
DEFAULT
A default instance using the
DEFAULT_BUFFER_SIZE. |
static int |
DEFAULT_BUFFER_SIZE
The default size of the buffer for draining a stream.
|
| Constructor and Description |
|---|
StreamDrainer()
Creates a stream drainer with the default buffer size.
|
StreamDrainer(int bufferSize)
Creates a stream drainer with the given buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
drain(InputStream inputStream)
Drains an input stream into a byte array.
|
public static final int DEFAULT_BUFFER_SIZE
public static final StreamDrainer DEFAULT
DEFAULT_BUFFER_SIZE.public StreamDrainer()
public StreamDrainer(int bufferSize)
bufferSize - The buffer size for reading from a given stream.public byte[] drain(InputStream inputStream) throws IOException
inputStream - The input stream to drain.IOException - If the stream reading causes an error.Copyright © 2014–2025. All rights reserved.