Package org.mule.munit.tools.util
Class ReusableByteArrayInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.mule.munit.tools.util.ReusableByteArrayInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
This is a special implementation of the ByteArrayInputStream.
Upon creation the ByteArrayInputStream is marked at the beginning of the array.
If the stream is fully consumed or if it is closed then it is automatically resetted.
- Since:
- 2.0.0
- Author:
- Mulesoft Inc.
-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
ConstructorsConstructorDescriptionReusableByteArrayInputStream(byte[] buf) ReusableByteArrayInputStream(byte[] buf, int offset, int length) -
Method Summary
Methods inherited from class java.io.ByteArrayInputStream
available, mark, markSupported, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytes, skipNBytes
-
Constructor Details
-
ReusableByteArrayInputStream
public ReusableByteArrayInputStream(byte[] buf) -
ReusableByteArrayInputStream
public ReusableByteArrayInputStream(byte[] buf, int offset, int length)
-
-
Method Details
-
read
public int read()- Overrides:
readin classByteArrayInputStream
-
read
public int read(byte[] b, int off, int len) - Overrides:
readin classByteArrayInputStream
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classByteArrayInputStream- Throws:
IOException
-