Package org.jcsp.net2

Class ResettableByteArrayInputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    final class ResettableByteArrayInputStream
    extends java.io.ByteArrayInputStream
    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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void reset​(byte[] bytes)
      Replaces the internal byte array
      • Methods inherited from class java.io.ByteArrayInputStream

        available, close, mark, markSupported, read, read, reset, skip
      • Methods inherited from class java.io.InputStream

        read
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResettableByteArrayInputStream

        ResettableByteArrayInputStream​(byte[] bytes)
        Creates a new ResettableByteArrayInputStream
        Parameters:
        bytes - The byte array to read data from
    • Method Detail

      • reset

        void reset​(byte[] bytes)
        Replaces the internal byte array
        Parameters:
        bytes - The byte array to replace the existing internal one