public interface PackageInput
A package is a collection of data consisting of entries. Each entry has a name and data. Data is read with InputStream to allow binary entries.
Most implementations will probably have entries in some order (such as order of data in a file). Thus it would be best if data is read in the same order it is returned by gotoNextEntry. If gotoEntry method is used, the implementation may need to read the file multiple times to find the required entries. However, because often entries will need to be read in a specific order, care should be taken when the package is created. To get best possible performance, entries should be stored in the order they are needed when unpackaging. The performance may suffer significantly if packages stored remotely instead of locally.
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the package.
|
java.util.Collection<java.lang.String> |
getEntries()
Get list of entries in the package.
|
java.io.InputStream |
getInputStream()
Gets input stream for current entry.
|
java.lang.String |
getSeparator()
Returns file separator used by the PackageInput.
|
boolean |
gotoEntry(java.lang.String name)
Moves to the entry that has the given name.
|
boolean |
gotoEntry(java.lang.String path,
java.lang.String name)
Moves to the entry that has the given path and name.
|
java.lang.String |
gotoNextEntry()
Moves to next entry and returns it's name.
|
java.lang.String |
joinPath(java.lang.String path,
java.lang.String name)
Joins path and name, and returns joined resource name.
|
boolean gotoEntry(java.lang.String name) throws java.io.IOException
name
- java.io.IOException
boolean gotoEntry(java.lang.String path, java.lang.String name) throws java.io.IOException
path
- name
- java.io.IOException
java.lang.String gotoNextEntry() throws java.io.IOException
java.io.IOException
java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
void close() throws java.io.IOException
java.io.IOException
java.util.Collection<java.lang.String> getEntries() throws java.io.IOException
java.io.IOException
java.lang.String getSeparator()
java.lang.String joinPath(java.lang.String path, java.lang.String name)
path
- name
- Copyright 2004-2015 Wandora Team