}
// If content couldn't be loaded, try to load model as a zipped file
ZipInputStream zipIn = null;
try {
URLContent urlContent = (URLContent)modelContent;
// Open zipped stream
zipIn = new ZipInputStream(urlContent.openStream());
// Parse entries to see if a obj file is readable
for (ZipEntry entry; (entry = zipIn.getNextEntry()) != null; ) {
try {
String entryName = entry.getName();
// Ignore directory entries and entries starting by a dot
if (!entryName.endsWith("/")) {
int slashIndex = entryName.lastIndexOf('/');
String entryFileName = entryName.substring(slashIndex + 1);
if (!entryFileName.startsWith(".")) {
int dotIndex = entryFileName.lastIndexOf(".");
if (dotIndex != -1) {
modelName = entryFileName.substring(0, dotIndex);
} else {
modelName = entryFileName;
}
URL entryUrl = new URL("jar:" + urlContent.getURL() + "!/"
+ URLEncoder.encode(entryName, "UTF-8").replace("+", "%20").replace("%2F", "/"));
modelContent = new TemporaryURLContent(entryUrl);
model = ModelManager.getInstance().loadModel(modelContent);
if (!entryFileName.toLowerCase().endsWith(".obj")
&& (this.preferences.isModelContentAlwaysConvertedToOBJFormat()