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