2017-05-17 19:20:42 +02:00
|
|
|
package de.mas.wiiu.jnus.implementations.woomy;
|
2016-12-12 21:01:12 +01:00
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.util.zip.ZipEntry;
|
|
|
|
import java.util.zip.ZipException;
|
|
|
|
import java.util.zip.ZipFile;
|
|
|
|
|
2017-05-17 19:20:42 +02:00
|
|
|
import de.mas.wiiu.jnus.utils.StreamUtils;
|
2016-12-12 21:01:12 +01:00
|
|
|
import lombok.Getter;
|
|
|
|
import lombok.Setter;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Woomy files are just zip files. This class is just the
|
|
|
|
* normal ZipFile class extended by an "isClosed" attribute.
|
2017-05-17 19:20:42 +02:00
|
|
|
*
|
2016-12-12 21:01:12 +01:00
|
|
|
* @author Maschell
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
public class WoomyZipFile extends ZipFile {
|
|
|
|
@Getter @Setter boolean isClosed;
|
2017-05-17 19:20:42 +02:00
|
|
|
|
2016-12-12 21:01:12 +01:00
|
|
|
public WoomyZipFile(File file) throws ZipException, IOException {
|
|
|
|
super(file);
|
|
|
|
}
|
2017-05-17 19:20:42 +02:00
|
|
|
|
2016-12-12 21:01:12 +01:00
|
|
|
@Override
|
|
|
|
public void close() throws IOException {
|
|
|
|
super.close();
|
|
|
|
setClosed(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
public byte[] getEntryAsByte(ZipEntry entry) throws IOException {
|
2017-05-17 19:20:42 +02:00
|
|
|
return StreamUtils.getBytesFromStream(getInputStream(entry), (int) entry.getSize());
|
2016-12-12 21:01:12 +01:00
|
|
|
}
|
|
|
|
}
|