JNUSLib/src/de/mas/wiiu/jnus/implementations/woomy/WoomyZipFile.java
2017-05-17 19:20:42 +02:00

37 lines
903 B
Java

package de.mas.wiiu.jnus.implementations.woomy;
import java.io.File;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import de.mas.wiiu.jnus.utils.StreamUtils;
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.
*
* @author Maschell
*
*/
public class WoomyZipFile extends ZipFile {
@Getter @Setter boolean isClosed;
public WoomyZipFile(File file) throws ZipException, IOException {
super(file);
}
@Override
public void close() throws IOException {
super.close();
setClosed(true);
}
public byte[] getEntryAsByte(ZipEntry entry) throws IOException {
return StreamUtils.getBytesFromStream(getInputStream(entry), (int) entry.getSize());
}
}