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(String zipName, String ext)ArchiveWriter(ZipFile archive)Deprecated, for removal: This API element is subject to removal in a future version.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, for removal: This API element is subject to removal in a future version.voidremoveImage(String name)voidsave()voidsave(boolean notifyModuleManager)voidsaveAs()voidsaveAs(boolean notifyModuleManager)voidwrite()Deprecated, for removal: This API element is subject to removal in a future version.voidwrite(boolean notifyModuleManager)Deprecated, for removal: This API element is subject to removal in a future version.protected voidwrite(FileArchive fa, boolean notifyModuleManager)Methods inherited from class VASSAL.tools.DataArchive
addExtension, addImageSource, 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, removeImageSource, setOfImageNames, unCacheImage, unCacheImageMethods 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
-
Constructor Details
-
ArchiveWriter
-
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, for removal: This API element is subject to removal in a future version.
-
-
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, for removal: This API element is subject to removal in a future version. -
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, for removal: This API element is subject to removal in a future version.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(since="2020-08-06", forRemoval=true) public void write(boolean notifyModuleManager) throws IOExceptionDeprecated, for removal: This API element is subject to removal in a future version.- Throws:
IOException
-