+ catch (IOException ioe) {
+ System.err.println("Got ioe from url: " + ioe.getMessage());
+ } // is stays null
+
+ // Now see if file is in the zip file
+ if (is == null && inZipFile != null && inZipFile.exists() && inZipFile.canRead())
+ {
+ try
+ {
+ zf = new ZipFile(inZipFile);
+ ZipEntry entry = zf.getEntry(inPath);
+ if (entry != null && entry.getSize() > 0)
+ {
+ data = ByteScooper.scoop(zf.getInputStream(entry));
+ // System.out.println("Size of data " + (data.length == entry.getSize()?"matches":"DOESN'T match"));
+ }
+ }
+ catch (IOException ioe) {
+ System.err.println("Got ioe from zip file: " + ioe.getMessage());
+ }
+ }
+ // Clean up input streams
+ if (is != null) try {
+ is.close();
+ } catch (IOException ioe) {}
+ if (zf != null) try {
+ zf.close();
+ } catch (IOException ioe) {}
+
+ if (data != null)
+ {
+ // Create Photo or AudioClip using this entry
+ String filename = new File(inPath).getName();
+ initFilters();
+ if (_jpegFilter.acceptFilename(inPath)) {
+ return new Photo(data, filename, url);
+ }
+ else if (_audioFilter.acceptFilename(inPath)) {
+ return new AudioClip(data, filename, url);
+ }
+ return null;
+ }
+
+ // If we haven't got a result by now, try to load plain file
+ File file = (inSourceFile == null ? new File(inPath) : new File(inSourceFile.getParent(), inPath));
+ return createMediaObject(file);
+ }
+
+ /**
+ * Construct a MediaObject for the given file
+ * @param inFile file to load
+ * @return either Photo or AudioClip object as appropriate, or null
+ */
+ private static MediaObject createMediaObject(File inFile)
+ {
+ if (inFile == null) {return null;}
+ if (!inFile.exists() || !inFile.canRead() || !inFile.isFile()) {return null;}
+ initFilters();