Minor fixups and method renaming.
This commit is contained in:
parent
618dd63b5c
commit
bd1e3ce83c
@ -48,7 +48,7 @@ public class DecalRegistry {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
InputStream is = forwardToEntry(name);
|
||||
InputStream is = findInZipContainer(name);
|
||||
if ( is != null ) {
|
||||
is.close();
|
||||
return true;
|
||||
@ -90,7 +90,7 @@ public class DecalRegistry {
|
||||
}
|
||||
|
||||
if ( rawIs == null && isZipFile ) {
|
||||
rawIs = forwardToEntry(name);
|
||||
rawIs = findInZipContainer(name);
|
||||
}
|
||||
|
||||
// Check absolute file name:
|
||||
@ -120,7 +120,6 @@ public class DecalRegistry {
|
||||
|
||||
try {
|
||||
byte[] bytes = FileUtils.readBytes(rawIs);
|
||||
// TODO - here we would update the cache.
|
||||
return new ByteArrayInputStream(bytes);
|
||||
}
|
||||
finally {
|
||||
@ -152,8 +151,13 @@ public class DecalRegistry {
|
||||
}
|
||||
|
||||
|
||||
private ZipInputStream forwardToEntry( String name ) throws IOException {
|
||||
ZipInputStream zis = new ZipInputStream(fileInfo.fileURL.openStream());
|
||||
private ZipInputStream findInZipContainer( String name ) {
|
||||
ZipInputStream zis = null;
|
||||
try {
|
||||
zis = new ZipInputStream(fileInfo.fileURL.openStream());
|
||||
} catch( IOException ex ) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
ZipEntry entry = zis.getNextEntry();
|
||||
while ( entry != null ) {
|
||||
@ -162,12 +166,16 @@ public class DecalRegistry {
|
||||
}
|
||||
entry = zis.getNextEntry();
|
||||
}
|
||||
}
|
||||
catch ( IOException ioex ) {
|
||||
zis.close();
|
||||
throw ioex;
|
||||
}
|
||||
zis.close();
|
||||
return null;
|
||||
}
|
||||
catch ( IOException ioex ) {
|
||||
try {
|
||||
zis.close();
|
||||
} catch ( IOException ex ) {
|
||||
// why does close throw? it's maddening
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user