Class ResettableByteArrayInputStream
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.jcsp.net2.ResettableByteArrayInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable
This class is used by the ObjectNetworkMessageFilter. It acts as a ByteArrayInputStream, but allows the internal byte
array to be replaced by another. This stops unnecessary object creation
-
Field Summary
Fields inherited from class ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
ConstructorsConstructorDescriptionResettableByteArrayInputStream(byte[] bytes) Creates a new ResettableByteArrayInputStream -
Method Summary
Modifier and TypeMethodDescription(package private) voidreset(byte[] bytes) Replaces the internal byte arrayMethods inherited from class ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skipMethods inherited from class InputStream
read
-
Constructor Details
-
ResettableByteArrayInputStream
ResettableByteArrayInputStream(byte[] bytes) Creates a new ResettableByteArrayInputStream- Parameters:
bytes- The byte array to read data from
-
-
Method Details
-
reset
void reset(byte[] bytes) Replaces the internal byte array- Parameters:
bytes- The byte array to replace the existing internal one
-