org.apache.commons.compress.archivers.arj

## Class ArjArchiveInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.apache.commons.compress.archivers.ArchiveInputStream
    - - org.apache.commons.compress.archivers.arj.ArjArchiveInputStream

- All Implemented Interfaces:
    Closeable, AutoCloseable

      public class ArjArchiveInputStream
      extends ArchiveInputStream

  Implements the "arj" archive format as an InputStream.

  Reference 1
  Reference 2

  Since:
    1.6
  This class is not thread-safe

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ArjArchiveInputStream(InputStream inputStream)` Constructs the ArjInputStream, taking ownership of the inputStream that is passed in, and using the CP437 character encoding.
    `ArjArchiveInputStream(InputStream inputStream, String charsetName)` Constructs the ArjInputStream, taking ownership of the inputStream that is passed in.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `canReadEntryData(ArchiveEntry ae)` Whether this stream is able to read the given entry.
    `void` | `close()`
    `String` | `getArchiveComment()` Gets the archive's comment.
    `String` | `getArchiveName()` Gets the archive's recorded name.
    `ArjArchiveEntry` | `getNextEntry()` Returns the next Archive Entry in this Stream.
    `static boolean` | `matches(byte[] signature, int length)` Checks if the signature matches what is expected for an arj file.
    `int` | `read(byte[] b, int off, int len)`

    - ### Methods inherited from class org.apache.commons.compress.archivers.ArchiveInputStream

      `count, count, getBytesRead, getCount, pushedBackBytes, read`

    - ### Methods inherited from class java.io.InputStream

      `available, mark, markSupported, read, reset, skip`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ArjArchiveInputStream

          public ArjArchiveInputStream(InputStream inputStream)
                                throws ArchiveException

      Constructs the ArjInputStream, taking ownership of the inputStream that is passed in, and using the CP437 character encoding.
      Parameters:
        `inputStream` - the underlying stream, whose ownership is taken
      Throws:
        `ArchiveException` - if an exception occurs while reading

    - #### ArjArchiveInputStream

          public ArjArchiveInputStream(InputStream inputStream,
                                       String charsetName)
                                throws ArchiveException

      Constructs the ArjInputStream, taking ownership of the inputStream that is passed in.
      Parameters:
        `inputStream` - the underlying stream, whose ownership is taken
        `charsetName` - the charset used for file names and comments in the archive. May be `null` to use the platform default.
      Throws:
        `ArchiveException` - if an exception occurs while reading

  - ### Method Detail

    - #### matches

          public static boolean matches(byte[] signature,
                                        int length)

      Checks if the signature matches what is expected for an arj file.
      Parameters:
        `signature` - the bytes to check
        `length` - the number of bytes to check
      Returns:
        true, if this stream is an arj archive stream, false otherwise

    - #### canReadEntryData

          public boolean canReadEntryData(ArchiveEntry ae)

      Description copied from class: `ArchiveInputStream`
      Whether this stream is able to read the given entry.

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

      Overrides:
        `canReadEntryData` in class `ArchiveInputStream`
      Parameters:
        `ae` - the entry to test
      Returns:
        This implementation always returns true.

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `InputStream`
      Throws:
        `IOException`

    - #### getArchiveComment

          public String getArchiveComment()

      Gets the archive's comment.
      Returns:
        the archive's comment

    - #### getArchiveName

          public String getArchiveName()

      Gets the archive's recorded name.
      Returns:
        the archive's name

    - #### getNextEntry

          public ArjArchiveEntry getNextEntry()
                                       throws IOException

      Description copied from class: `ArchiveInputStream`
      Returns the next Archive Entry in this Stream.
      Specified by:
        `getNextEntry` in class `ArchiveInputStream`
      Returns:
        the next entry, or `null` if there are no more entries
      Throws:
        `IOException` - if the next entry could not be read

    - #### read

          public int read(byte[] b,
                          int off,
                          int len)
                   throws IOException

      Overrides:
        `read` in class `InputStream`
      Throws:
        `IOException`

Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.