Class InputStreamRewinder

  • All Implemented Interfaces:
    DataRewinder<java.io.InputStream>

    public final class InputStreamRewinder
    extends java.lang.Object
    implements DataRewinder<java.io.InputStream>
    Implementation for InputStreams that rewinds streams by wrapping them in a buffered stream.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanup()
      Called when this rewinder is no longer needed and can be cleaned up.
      void fixMarkLimits()  
      java.io.InputStream rewindAndGet()
      Rewinds the wrapped data back to the beginning and returns the re-wound data (or a wrapper for the re-wound data).
      • Methods inherited from class java.lang.Object

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

      • InputStreamRewinder

        public InputStreamRewinder​(java.io.InputStream is,
                                   ArrayPool byteArrayPool)
    • Method Detail

      • rewindAndGet

        @NonNull
        public java.io.InputStream rewindAndGet()
                                         throws java.io.IOException
        Description copied from interface: DataRewinder
        Rewinds the wrapped data back to the beginning and returns the re-wound data (or a wrapper for the re-wound data).
        Specified by:
        rewindAndGet in interface DataRewinder<java.io.InputStream>
        Returns:
        An object pointing to the wrapped data.
        Throws:
        java.io.IOException
      • cleanup

        public void cleanup()
        Description copied from interface: DataRewinder
        Called when this rewinder is no longer needed and can be cleaned up.

        The underlying data may still be in use and should not be closed or invalidated.

        Specified by:
        cleanup in interface DataRewinder<java.io.InputStream>
      • fixMarkLimits

        public void fixMarkLimits()