Package org.rauschig.jarchivelib
Class ArchiveStream
- java.lang.Object
-
- java.io.InputStream
-
- org.rauschig.jarchivelib.ArchiveStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public abstract class ArchiveStream extends java.io.InputStream implements java.io.CloseableAn input stream of an archive. Can be used to retrieve each individualArchiveEntry.
ThegetNextEntry()method is used to reset the input stream ready for reading the data from the next entry.
-
-
Constructor Summary
Constructors Constructor Description ArchiveStream()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract ArchiveEntrycreateNextEntry()Abstract method to create the nextArchiveEntryfor theArchiveStreamimplementation.ArchiveEntrygetCurrentEntry()Returns theArchiveEntrythe stream currently points to.ArchiveEntrygetNextEntry()Moves the pointer of the stream to the nextArchiveEntryand returns it.booleanisClosed()Checks whether the current stream has been closed
-
-
-
Method Detail
-
getCurrentEntry
public ArchiveEntry getCurrentEntry()
Returns theArchiveEntrythe stream currently points to.- Returns:
- the current
ArchiveEntry
-
getNextEntry
public ArchiveEntry getNextEntry() throws java.io.IOException
Moves the pointer of the stream to the nextArchiveEntryand returns it.- Returns:
- the next archive entry.
- Throws:
java.io.IOException- propagated I/O exception
-
createNextEntry
protected abstract ArchiveEntry createNextEntry() throws java.io.IOException
Abstract method to create the nextArchiveEntryfor theArchiveStreamimplementation.- Returns:
- the next archive entry
- Throws:
java.io.IOException- propagated I/O exception
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
isClosed
public boolean isClosed()
Checks whether the current stream has been closed- Returns:
- true if the stream has been closed
-
-