JNUSLib/src/de/mas/jnus/lib/implementations/woomy/WoomyZipFile.java

36 lines
904 B
Java
Raw Normal View History

2016-12-12 21:01:12 +01:00
package de.mas.jnus.lib.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.jnus.lib.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());
}
}