public class ArjArchiveInputStream extends ArchiveInputStream
Modifier and Type | Field and Description |
---|---|
private static int |
ARJ_MAGIC_1 |
private static int |
ARJ_MAGIC_2 |
private java.lang.String |
charsetName |
private java.io.InputStream |
currentInputStream |
private LocalFileHeader |
currentLocalFileHeader |
private java.io.DataInputStream |
in |
private MainHeader |
mainHeader |
Constructor and Description |
---|
ArjArchiveInputStream(java.io.InputStream inputStream)
Constructs the ArjInputStream, taking ownership of the inputStream that is passed in,
and using the CP437 character encoding.
|
ArjArchiveInputStream(java.io.InputStream inputStream,
java.lang.String charsetName)
Constructs the ArjInputStream, taking ownership of the inputStream that is passed in.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canReadEntryData(ArchiveEntry ae)
Whether this stream is able to read the given entry.
|
void |
close() |
java.lang.String |
getArchiveComment()
Gets the archive's comment.
|
java.lang.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) |
private int |
read16(java.io.DataInputStream dataIn) |
private int |
read32(java.io.DataInputStream dataIn) |
private int |
read8(java.io.DataInputStream dataIn) |
private void |
readExtraData(int firstHeaderSize,
java.io.DataInputStream firstHeader,
LocalFileHeader localFileHeader) |
private void |
readFully(java.io.DataInputStream dataIn,
byte[] b) |
private byte[] |
readHeader() |
private LocalFileHeader |
readLocalFileHeader() |
private MainHeader |
readMainHeader() |
private java.lang.String |
readString(java.io.DataInputStream dataIn) |
count, count, getBytesRead, getCount, pushedBackBytes, read
private static final int ARJ_MAGIC_1
private static final int ARJ_MAGIC_2
private final java.io.DataInputStream in
private final java.lang.String charsetName
private final MainHeader mainHeader
private LocalFileHeader currentLocalFileHeader
private java.io.InputStream currentInputStream
public ArjArchiveInputStream(java.io.InputStream inputStream, java.lang.String charsetName) throws ArchiveException
inputStream
- the underlying stream, whose ownership is takencharsetName
- the charset used for file names and comments
in the archive. May be null
to use the platform default.ArchiveException
- if an exception occurs while readingpublic ArjArchiveInputStream(java.io.InputStream inputStream) throws ArchiveException
inputStream
- the underlying stream, whose ownership is takenArchiveException
- if an exception occurs while readingpublic void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
private int read8(java.io.DataInputStream dataIn) throws java.io.IOException
java.io.IOException
private int read16(java.io.DataInputStream dataIn) throws java.io.IOException
java.io.IOException
private int read32(java.io.DataInputStream dataIn) throws java.io.IOException
java.io.IOException
private java.lang.String readString(java.io.DataInputStream dataIn) throws java.io.IOException
java.io.IOException
private void readFully(java.io.DataInputStream dataIn, byte[] b) throws java.io.IOException
java.io.IOException
private byte[] readHeader() throws java.io.IOException
java.io.IOException
private MainHeader readMainHeader() throws java.io.IOException
java.io.IOException
private LocalFileHeader readLocalFileHeader() throws java.io.IOException
java.io.IOException
private void readExtraData(int firstHeaderSize, java.io.DataInputStream firstHeader, LocalFileHeader localFileHeader) throws java.io.IOException
java.io.IOException
public static boolean matches(byte[] signature, int length)
signature
- the bytes to checklength
- the number of bytes to checkpublic java.lang.String getArchiveName()
public java.lang.String getArchiveComment()
public ArjArchiveEntry getNextEntry() throws java.io.IOException
ArchiveInputStream
getNextEntry
in class ArchiveInputStream
null
if there are no more entriesjava.io.IOException
- if the next entry could not be readpublic boolean canReadEntryData(ArchiveEntry ae)
ArchiveInputStream
Some archive formats support variants or details that are not supported (yet).
canReadEntryData
in class ArchiveInputStream
ae
- the entry to testpublic int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException