Modifier and Type | Field and Description |
---|---|
protected java.util.zip.ZipEntry |
currentEntry
The next entry to read from the input stream.
|
protected java.util.Map<java.lang.String,java.io.File> |
files
A mapping of the files in the KMZ stream to their location in the temporary directory.
|
protected java.io.File |
tempDir
The directory to hold files copied from the stream.
|
protected java.util.zip.ZipInputStream |
zipStream
The zip stream created for the specified input stream.
|
Constructor and Description |
---|
KMZInputStream(java.io.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.
|
java.io.InputStream |
getKMLStream()
Returns an
InputStream to the first KML file within the stream. |
java.lang.String |
getSupportFilePath(java.lang.String path)
Returns an absolute path to a specified file within the KMZ stream.
|
java.io.InputStream |
getSupportFileStream(java.lang.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 java.util.zip.ZipEntry currentEntry
protected java.util.Map<java.lang.String,java.io.File> files
protected java.io.File tempDir
protected java.util.zip.ZipInputStream zipStream
public KMZInputStream(java.io.InputStream sourceStream) throws java.io.IOException
sourceStream
- the input stream to read from.java.lang.IllegalArgumentException
- if the specified stream is null.java.io.IOException
- if an error occurs while accessing the stream.protected void copyCurrentEntryToTempDir() throws java.io.IOException
java.io.IOException
- if an error occurs during the copy.public java.io.InputStream getKMLStream() throws java.io.IOException
InputStream
to the first KML file within the stream.getKMLStream
in interface KMLDoc
java.io.IOException
- if an error occurs while reading the stream.public java.lang.String getSupportFilePath(java.lang.String path) throws java.io.IOException
getSupportFilePath
in interface KMLDoc
path
- the path of the requested file.java.lang.IllegalArgumentException
- if the path is null.java.io.IOException
- if an error occurs while attempting to create a temporary file.public java.io.InputStream getSupportFileStream(java.lang.String path) throws java.io.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.java.lang.IllegalArgumentException
- if the path is null.java.io.IOException
- if an error occurs while attempting to read the input stream.protected void moveToNextEntry() throws java.io.IOException
java.io.IOException
- if an exception occurs while attempting to more the stream to the next entry.