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