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

37 lines
903 B
Java
Raw Normal View History

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;
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.
*
2016-12-12 21:01:12 +01:00
* @author Maschell
*
*/
public class WoomyZipFile extends ZipFile {
@Getter @Setter boolean isClosed;
2016-12-12 21:01:12 +01:00
public WoomyZipFile(File file) throws ZipException, IOException {
super(file);
}
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 {
return StreamUtils.getBytesFromStream(getInputStream(entry), (int) entry.getSize());
2016-12-12 21:01:12 +01:00
}
}