public static Metadata readImageMetadata(final String description, final InputStream imageStream, final boolean closeAfter) {
        if (imageStream == null) {
            Log.i("[MetadataUtils] Null stream received for '" + description + "'");
            return null;
        }
        try {
            return ImageMetadataReader.readMetadata(imageStream);
        } catch (IOException | ImageProcessingException | RuntimeException ie) {
            Log.w("[MetadataUtils] Problem reading metadata from " + description, ie);
        } finally {
            if (closeAfter) {
                IOUtils.closeQuietly(imageStream);
            }
        }
        return null;
    }
Tries to read metadata from given stream, assuming it is an image data stream

@param description describes the stream. Used for logging in case of errors
@param imageStream image data stream
@param closeAfter  if true, stream is closed after read
@return Metadata read, or null if metadata could not be read
main/src/main/java/cgeo/geocaching/utils/MetadataUtils.java