Package org.jcsp.net2
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 java.io.ByteArrayInputStream
buf, count, mark, pos
-
Constructor Summary
ConstructorsConstructorDescriptionResettableByteArrayInputStream
(byte[] bytes) Creates a new ResettableByteArrayInputStream -
Method Summary
Modifier and TypeMethodDescription(package private) void
reset
(byte[] bytes) Replaces the internal byte arrayMethods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, reset, skip
Methods inherited from class java.io.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
-