Package VASSAL.tools
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
FieldsModifier and TypeFieldDescriptionprotected FileArchiveprotected List<DataArchive>static final Stringstatic final Stringprotected Stringstatic final Stringprotected String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDataArchive(String zipName) DataArchive(String zipName, String imageDir) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExtension(DataArchive ext) DataArchives can extend other archives.protected voidvoidclose()booleanprotected Class<?>getAllLocalImageNames(boolean localized, boolean fullPath) protected voidgetAllLocalImageNamesForDirectory(SortedSet<String> s, String directory, boolean fullPath) getCachedAudioClip(String name) String[]getImageNameSet(boolean localized, boolean fullPath) protected voidprotected voidgetImageNamesRecursively(SortedSet<String> s, boolean localized, boolean fullPath) getInputStream(String fileName) Get anInputStreamfor the given file in the archive.getName()protected PermissionCollectiongetPermissions(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, defineClassMethods 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:
getNamein classClassLoader
-
getArchive
-
getImagePrefix
-
getCachedAudioClip
- Throws:
IOException
-
getInputStream
Get anInputStreamfor the given file in the archive.- Parameters:
fileName- the name of the file- Returns:
- an
InputStreamwhich 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
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein 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:
loadClassin classClassLoader- Throws:
ClassNotFoundException
-
getPermissions
- Overrides:
getPermissionsin classSecureClassLoader
-
findClass
- Overrides:
findClassin classClassLoader- Throws:
ClassNotFoundException
-