It seems that, according to the epic JDK reference, you could use a while zis.getNextEntry() != null
loop to loop through the file (where zis is a ZipInputStream), then use zis.read()
to read into an array, which is sent to an ArrayList or similar.
Then, one could use toArray()
, "cast" it to a byte array with this method and zos.write()
it into the output ZIP file (where zos is a ZipOutputStream
), using zos.putNextEntry()
to make new entries. (You will need to save the ZipEntry and get its name with ze.getName()
, with ze
being a ZipEntry
.)You should replace T
with Byte
and byte
(use byte
everywhere but the for
loop body) and may need to modify the casting code to use Byte.byteValue()
to convert from Byte
(wrapper class) to byte
(primitive type), like so:
for(int i = 0; i < objects.length; i++) {
convertedObjects[i] = (Byte)objects[i].byteValue();
}
Note that this is untested and based on the JDK (entries ZipInputStream
, ZipOutputStream
, ArrayList
, and Byte
) and a Google search on array casting.
Sorry if that was a bit dense, and hope this helps!!