// Check if the input object is an InputStream
if (source instanceof InputStream) {
// Use of the ImageInputStreamAdapter
if (isAggressiveInputStreamSupported()) {
stream = new ImageInputStreamAdapter((InputStream) source);
} else {
stream = new MemoryCacheImageInputStream((InputStream) source);
}
// Image reading