Package VASSAL.tools
Class ArchiveWriter
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
VASSAL.tools.DataArchive
VASSAL.tools.ArchiveWriter
- All Implemented Interfaces:
Closeable,AutoCloseable
public class ArchiveWriter extends DataArchive
An ArchiveWriter is a writeable DataArchive. New files may be added
with the
addFile(java.lang.String, java.lang.String) and addImage(java.lang.String, java.lang.String) methods.-
Field Summary
Fields inherited from class VASSAL.tools.DataArchive
archive, extensions, ICON_DIR, IMAGE_DIR, imageDir, imageNames, localImages, SOUND_DIR, soundDir, SOUNDS_DIR, soundsDir -
Constructor Summary
Constructors Constructor Description ArchiveWriter(String zipName)Create a new writeable archive.ArchiveWriter(ZipFile archive)Deprecated.ArchiveWriter(FileArchive archive) -
Method Summary
Modifier and Type Method Description voidaddFile(String fileName, byte[] content)voidaddFile(String fileName, InputStream in)Copy anInputStreaminto the archivevoidaddFile(String path, String fileName)Copy a file from the user's filesystem to the archive.voidaddImage(String name, byte[] contents)voidaddImage(String path, String name)Add an image file to the archive.voidaddSound(String path, String fileName)booleanisImageAdded(String name)Deprecated.voidremoveImage(String name)voidsave()voidsave(boolean notifyModuleManager)voidsaveAs()voidsaveAs(boolean notifyModuleManager)voidwrite()Deprecated.voidwrite(boolean notifyModuleManager)Deprecated.protected voidwrite(FileArchive fa, boolean notifyModuleManager)Methods inherited from class VASSAL.tools.DataArchive
addExtension, clearScaledImageCache, clearTransformedImageCache, close, contains, findClass, findImage, findImage, getArchive, getArchiveURL, getBytes, getCachedAudioClip, getCachedImage, getFileStream, getFileStream, getFileStream, getImage, getImage, getImageBounds, getImageInputStream, getImageNames, getImageNameSet, getImageNamesRecursively, getImagePrefix, getImageSize, getImageURL, getInputStream, getLocalImageNames, getName, getPermissions, getScaledImage, getScaledImage, getTransformedImage, getTransformedImage, getURL, getURL, getWriter, improvedScaling, isNameCacheStale, listImageNames, loadClass, setOfImageNames, unCacheImage, unCacheImageMethods 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
-
Constructor Details
-
ArchiveWriter
Create a new writeable archive.- Parameters:
zipName- the name of the archive. If null, the user will be prompted for a filename when saving. If not null, new entries will be added to the named archive. If the file exists and is not a zip archive, it will be overwritten.
-
ArchiveWriter
-
ArchiveWriter
Deprecated.
-
-
Method Details
-
addImage
Add an image file to the archive. The file will be copied into an "images" directory in the archive. Storing another image with the same name will overwrite the previous image.- Parameters:
path- the full path of the image file on the user's filesystemname- the name under which to store the image in the archive
-
addImage
-
addSound
-
isImageAdded
Deprecated. -
removeImage
-
addFile
Copy a file from the user's filesystem to the archive.- Parameters:
path- the full path of the file on the user's filesystemfileName- the name under which to store the file in the archive
-
addFile
Copy anInputStreaminto the archive- Parameters:
fileName- the name under which to store the contents of the streamin- the stream to copy
-
addFile
-
save
- Throws:
IOException
-
save
- Throws:
IOException
-
saveAs
- Throws:
IOException
-
write
- Throws:
IOException
-
saveAs
- Throws:
IOException
-
write
Deprecated.If the ArchiveWriter was initialized with non-null file name, then write the contents of the archive to the named archive. If it was initialized with a null name, prompt the user to select a new file into which to write archive.- Throws:
IOException
-
write
Deprecated.- Throws:
IOException
-