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

52 lines
1.7 KiB
Java

/****************************************************************************
* Copyright (C) 2016-2018 Maschell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
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());
}
}