-
Notifications
You must be signed in to change notification settings - Fork 6
zip
- ZIP.ZIP
- ZIP.clean
- ZIP.close
- ZIP.generate
- ZIP.generate2File
- ZIP.getFile
- ZIP.gunzip
- ZIP.gzip
- ZIP.list
- ZIP.load
- ZIP.loadFile
- ZIP.putFile
- ZIP.remove
- ZIP.streamGetFile
- ZIP.streamGetFileStream
- ZIP.streamPutFile
- ZIP.streamPutFileStream
- ZIP.streamRemoveFile
ZIP.ZIP(anArrayOfBytes) : ZIP
Creates a ZIP object instance. If anArrayOfBytes is provided it will read it as a ZIP compressed contents into the ZIP object.
ZIP.clean()
Will clean all internal data regarding any previously ZIP contents handled by this object.
ZIP.close()
Will close the ZIP file associated with this object.
ZIP.generate(aMapOfOptions, dontReload) : anArrayOfBytes
Will generate a ZIP anArrayOfBytes contents (that can then by saved into a file) given the provided options (a map where you can specify the compressionLevel as a number). If dontReload = true then the internal ZIP object contents won't be reloaded after generating. Example:
plugin("ZIP");
var zip = new ZIP();
var text = new java.lang.String("Some example test to zip into a zip file");
var openaf = io.readFileBytes("c:\apps\OpenAF\openaf.jar");
zip.putFile("text.txt", text.getBytes());
zip.putFile("openaf.jar", openaf);
var newZip = zip.generate({"compressionLevel": 9});
var zip = new ZIP(newZip);
print(beautifier(zip.list()));
ZIP.generate2File(aFile, aMapOfOptions, dontReload) : anArrayOfBytes
Will generate a ZIP into aFile given the provided options (a map where you can specify the compressionLevel as a number). If dontReload = true then the internal ZIP object contents won't be reloaded after generating.
ZIP.getFile(aFilename) : anArrayOfBytes
Will uncompress the corresponding aFilename from the ZIP contents into an arrays of bytes.
ZIP.gunzip(anArrayOfBytes) : anObject
Will gunzip/uncompress the provided anArrayOfBytes into the original anObject compressed with ZIP.gzip.
ZIP.gzip(anObject) : ArrayOfBytes
Will gzip/compress the contents of the anObject into an array of bytes. To uncompress use ZIP.gunzip.
ZIP.list() : Map
Will list all files and folders of the loaded ZIP contents into a Map with name, size, compressedSize, comment, crc and time.
ZIP.load(anArrayOfBytes)
Loads anArrayOfBytes ZIP contents into the internal object structures.
ZIP.loadFile(aFilename)
Will load a ZIP file aFilename into the ZIP object internal structure.
ZIP.putFile(aFilename, anArrayOfBytes)
Will add anArrayOfBytes to the ZIP contents as aFilename.
ZIP.remove(aFilename)
Will remove aFilename from the ZIP contents.
ZIP.streamGetFile(aFilePath, aName) : anArrayOfBytes
Retrieves aName file from aFilePath zip file without loading the zip file contents into memory returning the file contents as an array of bytes.
ZIP.streamGetFileStream(aFilePath, aName) : JavaInputStream
Retrieves aName file from aFilePath zip file without loading the zip file contents into memory returning a Java InputStream.
ZIP.streamPutFile(aFilePath, aName, anArrayOfBytes)
Sets a aName file on the aFilePath ZIP provided with the anArrayOfBytes provided. All missing directories will be created.
ZIP.streamPutFileStream(aFilePath, aName, aJavaInputStream)
Sets a aName file on the aFilePath ZIP provided with the aJavaInputStream provided. All missing directories will be created.
ZIP.streamRemoveFile(aFilePath, aName)
Removes a file/directory aName from the aFilePath ZIP file provided.