Class ZipMap
java.lang.Object
com.inductiveautomation.ignition.common.util.ZipMap
- All Implemented Interfaces:
Map<String,
ZipMapFile>
The ZipMap provides a convenient way of working with zip files by providing a
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.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionZipMap()
Creates an empty ZipMap.Create a ZipMap with the contents of the given zip file.ZipMap
(InputStream zipFile) Create a ZipMap with the contents of the given zip file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
boolean
containsKey
(Object key) boolean
containsValue
(Object value) protected void
entrySet()
boolean
isEmpty()
keySet()
protected byte[]
Convenience method for putting a file into the ZipMap.put
(String key, ZipMapFile value) Puts an entry into the ZipMap.Convenience method for putting a file into the ZipMap.void
putAll
(Map<? extends String, ? extends ZipMapFile> t) int
size()
values()
void
writeToFile
(File outputFile) Write the contents of this ZipMap to a zip file using the supplied File.void
writeToFile
(OutputStream outputStream) Write the contents of this ZipMap to a zip file using the supplied OutputStream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
-
Constructor Details
-
ZipMap
public ZipMap()Creates an empty ZipMap. Changes need to be explicitly written usingwriteToFile(File)
orwriteToFile(OutputStream)
. -
ZipMap
Create a ZipMap with the contents of the given zip file. Changes need to be explicitly written usingwriteToFile(File)
orwriteToFile(OutputStream)
.- Throws:
IOException
-
ZipMap
Create a ZipMap with the contents of the given zip file. Changes need to be explicitly written usingwriteToFile(File)
orwriteToFile(OutputStream)
.- Throws:
IOException
-
-
Method Details
-
loadEntry
-
ensureAllLoaded
- Throws:
IOException
-
writeToFile
Write the contents of this ZipMap to a zip file using the supplied File.- Parameters:
outputFile
- the file to write to- Throws:
IOException
- on failure to write
-
writeToFile
Write the contents of this ZipMap to a zip file using the supplied OutputStream.- Throws:
IOException
-
clear
public void clear()- Specified by:
clear
in interfaceMap<String,
ZipMapFile>
-
containsKey
- Specified by:
containsKey
in interfaceMap<String,
ZipMapFile>
-
containsValue
- Specified by:
containsValue
in interfaceMap<String,
ZipMapFile>
-
entrySet
- Specified by:
entrySet
in interfaceMap<String,
ZipMapFile>
-
get
- Specified by:
get
in interfaceMap<String,
ZipMapFile>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceMap<String,
ZipMapFile>
-
keySet
- Specified by:
keySet
in interfaceMap<String,
ZipMapFile>
-
put
Puts an entry into the ZipMap. Directory names should end with a "/".- Specified by:
put
in interfaceMap<String,
ZipMapFile>
-
put
Convenience method for putting a file into the ZipMap.- Parameters:
key
- Name of the file. Example: "hello.txt" or "dir/world.txt".value
- The file itself. A ZipMapFile will be created from this File.- Returns:
- The ZipMapFile added to the ZipMap.
-
put
Convenience method for putting a file into the ZipMap.- Parameters:
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.- Returns:
- The ZipMapFile added to the ZipMap.
-
putAll
- Specified by:
putAll
in interfaceMap<String,
ZipMapFile>
-
remove
- Specified by:
remove
in interfaceMap<String,
ZipMapFile>
-
size
public int size()- Specified by:
size
in interfaceMap<String,
ZipMapFile>
-
values
- Specified by:
values
in interfaceMap<String,
ZipMapFile>
-