public class MHTInputStream extends FilterInputStream
ZipInputStream. This class could also process (though
not tested) MHT files produced by other programs.in| Constructor and Description |
|---|
MHTInputStream(InputStream in)
Creates a new MHT input stream and reads the header of the MHT so
getBaseUrl() can be called immediately. |
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns 0 after EOF has reached for the current entry data, otherwise always return 1.
|
void |
close()
Closes this input stream and releases any system resources associated with the stream.
|
String |
getBaseUrl()
Returns the URL all MHT entries are referenced to.
|
MHTEntry |
getNextEntry()
Returns the next
MHTEntry in the stream and positions the stream at the beginning of the entry data. |
MHTEntry |
getNextEntry(String name)
Reads the next MHT entry with the name given and positions the stream at the beginning of the entry data.
|
void |
mark(int readlimit)
This operation is not supported with this input stream and
UnsupportedOperationException will be thrown if this method is called. |
boolean |
markSupported() |
int |
read(byte[] b,
int off,
int len)
Reads from the current MHT entry into an array of bytes.
|
void |
reset()
This operation is not supported with this input stream and
UnsupportedOperationException will be thrown if this method is called. |
long |
skip(long n)
This operation is not supported with this input stream and
UnsupportedOperationException will be thrown if this method is called. |
read, readpublic MHTInputStream(InputStream in) throws MHTException
getBaseUrl() can be called immediately.in - the actual input streamMHTException - if a MHT error has occurredpublic String getBaseUrl()
public MHTEntry getNextEntry(String name) throws IOException
null is returned and the stream is positioned at EOF.getBaseUrl()). E.g. If an entry
has an internal URL http://localhost/index.html and base URL of the stream is http://localhost/ then index.html
is the name of the entry. null next entry in stream is read.name - the name of the entry to read or null following entry is desirednull if no entry is found with the name providedIOException - if an I/O error has occurredMHTException - if a MHT error has occurredpublic MHTEntry getNextEntry() throws IOException
MHTEntry in the stream and positions the stream at the beginning of the entry data. This is equivalent to calling
getNextEntry(String) with null name.null if no more entries are available.IOException - if an I/O error has occurredMHTException - if a MHT error has occurredpublic int available()
throws IOException
available in class FilterInputStreamIOException - if an I/O error has occurredpublic long skip(long n)
throws IOException
UnsupportedOperationException will be thrown if this method is called.skip in class FilterInputStreamUnsupportedOperationException - if calledIOExceptionpublic boolean markSupported()
markSupported in class FilterInputStreampublic void mark(int readlimit)
UnsupportedOperationException will be thrown if this method is called.mark in class FilterInputStreamUnsupportedOperationException - if calledpublic void reset()
throws IOException
UnsupportedOperationException will be thrown if this method is called.reset in class FilterInputStreamUnsupportedOperationException - if calledIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class FilterInputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class FilterInputStreamb - the buffer into which the data is readoff - the start offset in the destination array blen - the maximum number of bytes readIOExceptionCopyright © 2016–2017. All rights reserved.