mirror of
https://github.com/corda/corda.git
synced 2025-04-16 07:27:17 +00:00
close ZipFile when done with it in Zip test
This commit is contained in:
parent
651ad20fc3
commit
64b11f0c64
@ -27,20 +27,24 @@ public class Zip {
|
||||
ZipFile file = new ZipFile
|
||||
(findJar(new File(System.getProperty("user.dir"))));
|
||||
|
||||
byte[] buffer = new byte[4096];
|
||||
for (Enumeration<? extends ZipEntry> e = file.entries();
|
||||
e.hasMoreElements();)
|
||||
{
|
||||
ZipEntry entry = e.nextElement();
|
||||
InputStream in = file.getInputStream(entry);
|
||||
try {
|
||||
int size = 0;
|
||||
int c; while ((c = in.read(buffer)) != -1) size += c;
|
||||
System.out.println
|
||||
(entry.getName() + " " + entry.getCompressedSize() + " " + size);
|
||||
} finally {
|
||||
in.read();
|
||||
try {
|
||||
byte[] buffer = new byte[4096];
|
||||
for (Enumeration<? extends ZipEntry> e = file.entries();
|
||||
e.hasMoreElements();)
|
||||
{
|
||||
ZipEntry entry = e.nextElement();
|
||||
InputStream in = file.getInputStream(entry);
|
||||
try {
|
||||
int size = 0;
|
||||
int c; while ((c = in.read(buffer)) != -1) size += c;
|
||||
System.out.println
|
||||
(entry.getName() + " " + entry.getCompressedSize() + " " + size);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
file.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user