if (output instanceof OutputStream) {
if (useCache) {
return new FileCacheImageOutputStream((OutputStream) output, cacheDir);
} else {
return new MemoryCacheImageOutputStream((OutputStream) output);
}
}
throw new IllegalArgumentException("Output is not an instance of OutputStream");