More fixes in zip entries for path
This commit is contained in:
@@ -72,12 +72,24 @@ public final class ZipEntryPath implements Path {
|
||||
|
||||
@Override
|
||||
public InputStream getInputStream() throws IOException {
|
||||
ZipFile zipFile = new ZipFile(this.zipFilePath.absolutePath.toFile());
|
||||
return new ZipEntryInputStream(zipFile,
|
||||
zipFile.getInputStream(zipFile.getEntry(this.entryName)));
|
||||
if (this.zipFilePath.exists()) {
|
||||
ZipFile zipFile = new ZipFile(this.zipFilePath.absolutePath.toFile());
|
||||
ZipEntry zipEntry = zipFile.getEntry(this.entryName);
|
||||
if (zipEntry != null) {
|
||||
return new ZipEntryInputStream(zipFile, zipFile.getInputStream(zipEntry));
|
||||
} else {
|
||||
throw new IOException("Zip entry does not exist.");
|
||||
}
|
||||
} else {
|
||||
throw new IOException("Zip file does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
private void fetchEntryData() {
|
||||
if (!this.zipFilePath.exists()) {
|
||||
return;
|
||||
}
|
||||
|
||||
try (ZipFile zipFile = new ZipFile(this.zipFilePath.absolutePath.toFile())) {
|
||||
ZipEntry zipEntry = zipFile.getEntry(this.entryName);
|
||||
this.exists = zipEntry != null;
|
||||
|
||||
Reference in New Issue
Block a user