Package net.bytebuddy.utility
Class StreamDrainer
- java.lang.Object
-
- net.bytebuddy.utility.StreamDrainer
-
public class StreamDrainer extends java.lang.ObjectA utility for draining the contents of anInputStreaminto abytearray.
-
-
Field Summary
Fields Modifier and Type Field Description static StreamDrainerDEFAULTA default instance using theDEFAULT_BUFFER_SIZE.static intDEFAULT_BUFFER_SIZEThe default size of the buffer for draining a stream.
-
Constructor Summary
Constructors Constructor Description StreamDrainer()Creates a stream drainer with the default buffer size.StreamDrainer(int bufferSize)Creates a stream drainer with the given buffer size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]drain(java.io.InputStream inputStream)Drains an input stream into a byte array.
-
-
-
Field Detail
-
DEFAULT_BUFFER_SIZE
public static final int DEFAULT_BUFFER_SIZE
The default size of the buffer for draining a stream.- See Also:
- Constant Field Values
-
DEFAULT
public static final StreamDrainer DEFAULT
A default instance using theDEFAULT_BUFFER_SIZE.
-
-
Method Detail
-
drain
public byte[] drain(java.io.InputStream inputStream) throws java.io.IOExceptionDrains an input stream into a byte array. The given input stream is not closed.- Parameters:
inputStream- The input stream to drain.- Returns:
- A byte array containing the content of the input stream.
- Throws:
java.io.IOException- If the stream reading causes an error.
-
-