throw new JXAException(src + " cannot be read");
}
raf = new RandomAccessFile(inputFile, "r");
is = JXAenvUtils2.__getBuffered(new FileInputStream(raf.getFD()), bigBuffer);
if (useCache) {
r.setInput(new FileCacheImageInputStream(is, tmpDir));
} else {
r.setInput(ImageIO.createImageInputStream(is));
}
} else if (src instanceof ImageInputStream) {
r.setInput(src);
} else if (src instanceof InputStream) {
is = JXAenvUtils2.__getBuffered((InputStream) src, bigBuffer);
if (useCache) {
r.setInput(new FileCacheImageInputStream(is, tmpDir));
} else {
r.setInput(ImageIO.createImageInputStream(is));
}
} else if (src instanceof String) {
if (!src.equals(NO_SOURCE)) {
if (!isExtClassLoaderRes()) {
is = JXAenvUtils2.__getBuffered(Sprite.class.getResourceAsStream((String) src), bigBuffer);
} else {
is = JXAenvUtils2.__getBuffered(ExtensionsClassLoader.getInstance().getClassLoader().getResourceAsStream(_contextResource((String) src)), bigBuffer); /*
* Thread.currentThread().getContextClassLoader().getResourceAsStream(_contextResource((String)
* src));
*/
}
if (useCache) {
r.setInput(new FileCacheImageInputStream(is, tmpDir));
} else {
r.setInput(ImageIO.createImageInputStream(is));
}
} else {
throw new JXAException("reading is not supported from " + src);
}
} else if (src instanceof File) {
raf = new RandomAccessFile((File) src, "r");
is = JXAenvUtils2.__getBuffered(new FileInputStream(raf.getFD()), bigBuffer);
if (useCache) {
r.setInput(new FileCacheImageInputStream(is, tmpDir));
} else {
r.setInput(ImageIO.createImageInputStream(is));
}
} else {
throw new JXAException(src.getClass() + " input is not supported");