Class ArchiveInputStream<E extends ArchiveEntry>

    • Field Summary

      • Fields inherited from class java.io.FilterInputStream

        in
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
        ArchiveInputStream()
      Constructs a new instance.
      protected ArchiveInputStream​(java.io.InputStream inputStream, java.lang.String charsetName)
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      boolean canReadEntryData​(ArchiveEntry archiveEntry)
      Tests whether this stream is able to read the given entry.
      protected void count​(int read)
      Increments the counter of already read bytes.
      protected void count​(long read)
      Increments the counter of already read bytes.
      void forEach​(org.apache.commons.io.function.IOConsumer<? super E> action)
      Performs the given action for each element of the stream until all elements have been processed or the action throws an exception.
      long getBytesRead()
      Gets the current number of bytes read from this stream.
      java.nio.charset.Charset getCharset()
      Gets the Charset.
      int getCount()
      Deprecated.
      this method may yield wrong results for large archives, use getBytesRead() instead.
      abstract E getNextEntry()
      Gets the next Archive Entry in this Stream.
      org.apache.commons.io.function.IOIterator<E> iterator()
      Returns an iterator over the SubField elements in this extra field in proper sequence.
      void mark​(int readlimit)
      Does nothing.
      boolean markSupported()
      Always returns false.
      protected void pushedBackBytes​(long pushedBack)
      Decrements the counter of already read bytes.
      int read()
      Reads a byte of data.
      void reset()
      Does nothing.
      • Methods inherited from class java.io.FilterInputStream

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

        nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
      • Methods inherited from class java.lang.Object

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

      • ArchiveInputStream

        protected ArchiveInputStream​(java.io.InputStream inputStream,
                                     java.lang.String charsetName)
        Constructs a new instance.
        Parameters:
        inputStream - the underlying input stream, or null if this instance is to be created without an underlying stream.
        charsetName - charset name.
        Since:
        1.26.0
    • Method Detail

      • canReadEntryData

        public boolean canReadEntryData​(ArchiveEntry archiveEntry)
        Tests whether this stream is able to read the given entry.

        Some archive formats support variants or details that are not supported (yet).

        Parameters:
        archiveEntry - the entry to test.
        Returns:
        This implementation always returns true.
        Since:
        1.1
      • count

        protected void count​(int read)
        Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1).
        Parameters:
        read - the number of bytes read.
      • count

        protected void count​(long read)
        Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1).
        Parameters:
        read - the number of bytes read.
        Since:
        1.1
      • forEach

        public void forEach​(org.apache.commons.io.function.IOConsumer<? super E> action)
                     throws java.io.IOException
        Performs the given action for each element of the stream until all elements have been processed or the action throws an exception. Actions are performed in the order of iteration. Exceptions thrown by the action are relayed to the caller.

        The behavior of this method is unspecified if the action performs side-effects that modify the underlying source of elements, unless an overriding class has specified a concurrent modification policy.

        Parameters:
        action - The action to be performed for each element.
        Throws:
        java.io.IOException - if an I/O error occurs.
        java.lang.NullPointerException - if the specified action is null.
        Since:
        1.27.0
      • getBytesRead

        public long getBytesRead()
        Gets the current number of bytes read from this stream.
        Returns:
        the number of read bytes.
        Since:
        1.1
      • getCharset

        public java.nio.charset.Charset getCharset()
        Gets the Charset.
        Returns:
        the Charset.
      • getCount

        @Deprecated
        public int getCount()
        Deprecated.
        this method may yield wrong results for large archives, use getBytesRead() instead.
        Gets the current number of bytes read from this stream.
        Returns:
        the number of read.
      • getNextEntry

        public abstract E getNextEntry()
                                throws java.io.IOException
        Gets the next Archive Entry in this Stream.
        Returns:
        the next entry, or null if there are no more entries.
        Throws:
        java.io.IOException - if the next entry could not be read.
      • iterator

        public org.apache.commons.io.function.IOIterator<Eiterator()
        Returns an iterator over the SubField elements in this extra field in proper sequence.
        Returns:
        an iterator over the SubField elements in this extra field in proper sequence.
        Since:
        1.27.0
      • mark

        public void mark​(int readlimit)
        Does nothing.

        TODO [COMPRESS-670] Support mark() and reset() in ArchiveInputStream.

        Overrides:
        mark in class java.io.FilterInputStream
        Parameters:
        readlimit - ignored.
      • markSupported

        public boolean markSupported()
        Always returns false.

        TODO [COMPRESS-670] Support mark() and reset() in ArchiveInputStream.

        Overrides:
        markSupported in class java.io.FilterInputStream
        Returns:
        Always returns false.
      • pushedBackBytes

        protected void pushedBackBytes​(long pushedBack)
        Decrements the counter of already read bytes.
        Parameters:
        pushedBack - the number of bytes pushed back.
        Since:
        1.1
      • read

        public int read()
                 throws java.io.IOException
        Reads a byte of data. This method will block until enough input is available.

        Simply calls the FilterInputStream.read(byte[], int, int) method.

        MUST be overridden if the FilterInputStream.read(byte[], int, int) method is not overridden; may be overridden otherwise.

        Overrides:
        read in class java.io.FilterInputStream
        Returns:
        the byte read, or -1 if end of input is reached.
        Throws:
        java.io.IOException - if an I/O error has occurred.
      • reset

        public void reset()
                   throws java.io.IOException
        Does nothing.

        TODO [COMPRESS-670] Support mark() and reset() in ArchiveInputStream.

        Overrides:
        reset in class java.io.FilterInputStream
        Throws:
        java.io.IOException - not thrown here but may be thrown from a subclass.