if (dst instanceof String) {
File outputFile = new File((String) dst);
raf = new RandomAccessFile(outputFile, "rw");
os = JXAenvUtils2.__getBuffered(new FileOutputStream(raf.getFD()), bigBuffer);
if (useCache) {
w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
} else {
w.setOutput(ImageIO.createImageOutputStream(os));
}
} else if (dst instanceof OutputStream) {
os = JXAenvUtils2.__getBuffered((OutputStream) dst, bigBuffer);
if (useCache) {
w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
} else {
w.setOutput(ImageIO.createImageOutputStream(os));
}
} else if (dst instanceof File) {
raf = new RandomAccessFile((File) dst, "rw");
os = JXAenvUtils2.__getBuffered(new FileOutputStream(raf.getFD()), bigBuffer);
if (useCache) {
w.setOutput(new FileCacheImageOutputStream(os, tmpDir));
} else {
w.setOutput(ImageIO.createImageOutputStream(os));
}
} else if (dst instanceof ImageOutputStream) {
w.setOutput(dst);