Modifier and Type | Field and Description |
---|---|
protected ZipEntry |
currentEntry
The next entry to read from the input stream.
|
protected Map<String,File> |
files
A mapping of the files in the KMZ stream to their location in the temporary directory.
|
protected File |
tempDir
The directory to hold files copied from the stream.
|
protected ZipInputStream |
zipStream
The zip stream created for the specified input stream.
|
Constructor and Description |
---|
KMZInputStream(InputStream sourceStream)
Constructs a KMZInputStream instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
copyCurrentEntryToTempDir()
Copies a file from the input stream to the temporary area created to represent the KMZ contents.
|
InputStream |
getKMLStream()
Returns an
InputStream to the first KML file within the stream. |
String |
getSupportFilePath(String path)
Returns an absolute path to a specified file within the KMZ stream.
|
InputStream |
getSupportFileStream(String path)
Returns an
InputStream to a specified file within the KMZ stream. |
protected void |
moveToNextEntry()
Moves this stream to its next zip entry and updates this stream's current-entry field.
|
protected ZipEntry currentEntry
protected Map<String,File> files
protected File tempDir
protected ZipInputStream zipStream
public KMZInputStream(InputStream sourceStream) throws IOException
sourceStream
- the input stream to read from.IllegalArgumentException
- if the specified stream is null.IOException
- if an error occurs while accessing the stream.protected void copyCurrentEntryToTempDir() throws IOException
IOException
- if an error occurs during the copy.public InputStream getKMLStream() throws IOException
InputStream
to the first KML file within the stream.getKMLStream
in interface KMLDoc
IOException
- if an error occurs while reading the stream.public String getSupportFilePath(String path) throws IOException
getSupportFilePath
in interface KMLDoc
path
- the path of the requested file.IllegalArgumentException
- if the path is null.IOException
- if an error occurs while attempting to create a temporary file.public InputStream getSupportFileStream(String path) throws IOException
InputStream
to a specified file within the KMZ stream. The file's path is resolved relative to
the internal root of the KMZ file represented by the stream.
Note: Since relative references to files outside the stream have no meaning, this class does not resolve relative
references to files in other KMZ archives. For example, it does not resolve references like this:
../other.kmz/file.png.getSupportFileStream
in interface KMLDoc
path
- the path of the requested file.IllegalArgumentException
- if the path is null.IOException
- if an error occurs while attempting to read the input stream.protected void moveToNextEntry() throws IOException
IOException
- if an exception occurs while attempting to more the stream to the next entry.