Class FragmentedImpExInputStream

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

    public class FragmentedImpExInputStream
    extends java.io.InputStream
    An input stream for reading the fragmented ImpEx file content received from DataHub.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int available()  
      void close()  
      boolean markSupported()  
      int read()  
      int read​(byte[] b, int off, int len)
      Override in order to catch custom exception and rethrow IOException.
      • Methods inherited from class java.io.InputStream

        mark, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, transferTo
      • Methods inherited from class java.lang.Object

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

      • FragmentedImpExInputStream

        public FragmentedImpExInputStream​(java.util.List<ImpExFragment> f)
        Instantiates this input stream.
        Parameters:
        f - a list of ImpEx fragments to read content from. This stream will read the fragments in the same order they received in the list.
    • Method Detail

      • read

        public int read()
        Specified by:
        read in class java.io.InputStream
      • read

        public int read​(byte[] b,
                        int off,
                        int len)
                 throws java.io.IOException
        Override in order to catch custom exception and rethrow IOException. This is necessary because the default implementation swallows IOException silently which causes MediaUtil.copy() to continue to read as it expects more data to arrive.
        Overrides:
        read in class java.io.InputStream
        Parameters:
        b -
        off -
        len -
        Returns:
        The amount of bytes that were read.
        Throws:
        java.io.IOException
      • available

        public int available()
                      throws java.io.IOException
        Overrides:
        available in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream