public class ZipMap extends java.lang.Object implements java.util.Map<java.lang.String,ZipMapFile>
Map
that is backed by a zip
file.
A variety of constructors are available for creating the ZipMap. Once loaded, you can work with file objects as you would work with any normal map. To save changes, you must call writeToFile.
Modifier and Type | Class and Description |
---|---|
protected class |
ZipMap.ZipMapFileImpl |
Constructor and Description |
---|
ZipMap()
Creates an empty ZipMap.
|
ZipMap(java.io.File zipFile)
Create a ZipMap with the contents of the given zip file.
|
ZipMap(java.io.InputStream zipFile)
Create a ZipMap with the contents of the given zip file.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
boolean |
containsKey(java.lang.Object key) |
boolean |
containsValue(java.lang.Object value) |
protected void |
ensureAllLoaded() |
java.util.Set<java.util.Map.Entry<java.lang.String,ZipMapFile>> |
entrySet() |
ZipMapFile |
get(java.lang.Object key) |
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet() |
protected byte[] |
loadEntry(java.util.zip.ZipEntry e) |
ZipMapFile |
put(java.lang.String key,
byte[] value)
Convenience method for putting a file into the ZipMap.
|
ZipMapFile |
put(java.lang.String key,
java.io.File value)
Convenience method for putting a file into the ZipMap.
|
ZipMapFile |
put(java.lang.String key,
ZipMapFile value)
Puts an entry into the ZipMap.
|
void |
putAll(java.util.Map<? extends java.lang.String,? extends ZipMapFile> t) |
ZipMapFile |
remove(java.lang.Object key) |
int |
size() |
java.util.Collection<ZipMapFile> |
values() |
void |
writeToFile(java.io.File outputFile)
Write the contents of this ZipMap to a zip file using the supplied File.
|
void |
writeToFile(java.io.OutputStream outputStream)
Write the contents of this ZipMap to a zip file using the supplied OutputStream.
|
public ZipMap()
writeToFile(File)
or
writeToFile(OutputStream)
.public ZipMap(java.io.File zipFile) throws java.io.IOException
writeToFile(File)
or writeToFile(OutputStream)
.java.io.IOException
public ZipMap(java.io.InputStream zipFile) throws java.io.IOException
writeToFile(File)
or writeToFile(OutputStream)
.java.io.IOException
protected byte[] loadEntry(java.util.zip.ZipEntry e)
protected void ensureAllLoaded() throws java.io.IOException
java.io.IOException
public void writeToFile(java.io.File outputFile) throws java.io.IOException
outputFile
- the file to write tojava.io.IOException
- on failure to writepublic void writeToFile(java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
public void clear()
clear
in interface java.util.Map<java.lang.String,ZipMapFile>
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map<java.lang.String,ZipMapFile>
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map<java.lang.String,ZipMapFile>
public java.util.Set<java.util.Map.Entry<java.lang.String,ZipMapFile>> entrySet()
entrySet
in interface java.util.Map<java.lang.String,ZipMapFile>
public ZipMapFile get(java.lang.Object key)
get
in interface java.util.Map<java.lang.String,ZipMapFile>
public boolean isEmpty()
isEmpty
in interface java.util.Map<java.lang.String,ZipMapFile>
public java.util.Set<java.lang.String> keySet()
keySet
in interface java.util.Map<java.lang.String,ZipMapFile>
public ZipMapFile put(java.lang.String key, ZipMapFile value)
put
in interface java.util.Map<java.lang.String,ZipMapFile>
public ZipMapFile put(java.lang.String key, java.io.File value)
key
- Name of the file. Example: "hello.txt" or "dir/world.txt".value
- The file itself. A ZipMapFile will be created from this File.public ZipMapFile put(java.lang.String key, byte[] value)
key
- Name of the file. Example: "hello.txt" or "dir/world.txt".value
- The byte[] itself. A ZipMapFile will be created from this byte[] with directory=false.public void putAll(java.util.Map<? extends java.lang.String,? extends ZipMapFile> t)
putAll
in interface java.util.Map<java.lang.String,ZipMapFile>
public ZipMapFile remove(java.lang.Object key)
remove
in interface java.util.Map<java.lang.String,ZipMapFile>
public int size()
size
in interface java.util.Map<java.lang.String,ZipMapFile>
public java.util.Collection<ZipMapFile> values()
values
in interface java.util.Map<java.lang.String,ZipMapFile>