Class MutableByteArrayInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.apache.flink.formats.avro.utils.MutableByteArrayInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
An extension of the ByteArrayInputStream that allows to change a buffer that should be read
without creating a new ByteArrayInputStream instance. This allows to re-use the same InputStream
instance, copying message to process, and creation of Decoder on every new message.
-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetBuffer(byte[] buf) Set buffer that can be read via the InputStream interface and reset the input stream.Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytes
-
Constructor Details
-
MutableByteArrayInputStream
public MutableByteArrayInputStream()
-
-
Method Details
-
setBuffer
public void setBuffer(byte[] buf) Set buffer that can be read via the InputStream interface and reset the input stream. This has the same effect as creating a new ByteArrayInputStream with a new buffer.- Parameters:
buf- the new buffer to read.
-