parent
c510211957
commit
06e05d821b
Binary file not shown.
|
@ -611,19 +611,14 @@ public class ConfigDefinition {
|
||||||
while ((zipEntry = zis.getNextEntry()) != null) {
|
while ((zipEntry = zis.getNextEntry()) != null) {
|
||||||
Path zippedName = Paths.get(zipEntry.getName()).normalize();
|
Path zippedName = Paths.get(zipEntry.getName()).normalize();
|
||||||
Path searchName = Paths.get(fileName).normalize();
|
Path searchName = Paths.get(fileName).normalize();
|
||||||
if (zippedName.equals(searchName) && zipEntry.getSize() >= 0) {
|
if (zippedName.equals(searchName)) {
|
||||||
int offset = 0;
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
byte[] tmpData = new byte[(int) zipEntry.getSize()];
|
byte[] buffer = new byte[4096];
|
||||||
int bytesLeft = tmpData.length, bytesRead;
|
int read;
|
||||||
while (bytesLeft > 0 && (bytesRead = zis.read(tmpData, offset, bytesLeft)) >= 0) {
|
while ((read = zis.read(buffer)) != -1) {
|
||||||
offset += bytesRead;
|
baos.write(buffer, 0, read);
|
||||||
bytesLeft -= bytesRead;
|
|
||||||
}
|
|
||||||
if (bytesLeft == 0) {
|
|
||||||
data = tmpData;
|
|
||||||
} else {
|
|
||||||
System.out.println("Unzip: error extracting file " + fileName);
|
|
||||||
}
|
}
|
||||||
|
data = baos.toByteArray();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue