Class DataArchive
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
VASSAL.tools.DataArchive
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ArchiveWriter
,JarArchive
Wrapper around a Zip archive with methods to cache images
-
Field Summary
Modifier and TypeFieldDescriptionprotected FileArchive
protected List
<DataArchive> static final String
static final String
protected String
static final String
protected String
-
Constructor Summary
ModifierConstructorDescriptionprotected
DataArchive
(String zipName) DataArchive
(String zipName, String imageDir) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addExtension
(DataArchive ext) DataArchives can extend other archives.protected void
void
close()
boolean
boolean
protected Class
<?> getAllLocalImageNames
(boolean localized, boolean fullPath) protected void
getAllLocalImageNamesForDirectory
(SortedSet<String> s, String directory, boolean fullPath) getCachedAudioClip
(String name) String[]
getImageNameSet
(boolean localized, boolean fullPath) protected void
protected void
getImageNamesRecursively
(SortedSet<String> s, boolean localized, boolean fullPath) getInputStream
(String fileName) Get anInputStream
for the given file in the archive.getName()
protected PermissionCollection
getPermissions
(CodeSource codesource) getURL()
Returns a URL pointing to the archive.Returns a URL pointing to the named file.Return the writeable instance of DataArchive, either this or one of its extensions.Class
<?> //////////////////////////////////////////////////////////////////Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
archive
-
extensions
-
localImages
-
cachedLocalImages
-
IMAGE_DIR
- See Also:
-
imageDir
-
SOUND_DIR
- See Also:
-
soundDir
-
ICON_DIR
- See Also:
-
-
Constructor Details
-
DataArchive
protected DataArchive() -
DataArchive
- Throws:
IOException
-
DataArchive
- Throws:
IOException
-
-
Method Details
-
getName
- Overrides:
getName
in classClassLoader
-
getArchive
-
getImagePrefix
-
getCachedAudioClip
- Throws:
IOException
-
getInputStream
Get anInputStream
for the given file in the archive.- Parameters:
fileName
- the name of the file- Returns:
- an
InputStream
which contains the file - Throws:
IOException
- if there is a problem reading the fileFileNotFoundException
- if the file doesn't exist
-
getURL
Returns a URL pointing to the archive.- Returns:
- a URL corresponding to this archive
- Throws:
IOException
- if the archive has not yet been saved
-
getURL
Returns a URL pointing to the named file.- Parameters:
fileName
- the name of the file- Returns:
- a URL corresponding to the file
- Throws:
FileNotFoundException
- if the file doesn't existIOException
- if some other problem occurs
-
contains
- Throws:
IOException
-
contains
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getImageNames
-
getImageNameSet
-
getImageNameSet
-
getImageNamesRecursively
-
getImageNamesRecursively
-
getLocalImageNames
-
buildLocalizedDirectoryList
-
getAllLocalImageNamesForDirectory
-
getAllLocalImageNames
-
addExtension
DataArchives can extend other archives. The extensions will be searched for data if not found in the parent archive.- Parameters:
ext
- the extension
-
getWriter
Return the writeable instance of DataArchive, either this or one of its extensions. (At most one archive should be edited at a time.)- Returns:
- writer
-
loadClass
//////////////////////////////////////////////////////////////////- Overrides:
loadClass
in classClassLoader
- Throws:
ClassNotFoundException
-
getPermissions
- Overrides:
getPermissions
in classSecureClassLoader
-
findClass
- Overrides:
findClass
in classClassLoader
- Throws:
ClassNotFoundException
-