/** * Parses the the given InputStream with the given options * * @throws java.io.IOException * @throws ExifInvalidFormatException */ protected static ExifParser parse( InputStream inputStream, int options, ExifInterface iRef ) throws IOException, ExifInvalidFormatException { return new ExifParser( inputStream, options, iRef ); } //
ExifParser parser = ExifParser.parse( inputStream, options, mInterface ); ExifData exifData = new ExifData( parser.getByteOrder() ); exifData.setSections( parser.getSections() ); exifData.mUncompressedDataPosition = parser.getUncompressedDataPosition(); exifData.setQualityGuess( parser.getQualityGuess() ); exifData.setJpegProcess( parser.getJpegProcess() ); final int w = parser.getImageWidth(); final int h = parser.getImageLength(); int event = parser.next(); while( event != ExifParser.EVENT_END ) { switch( event ) { case ExifParser.EVENT_START_OF_IFD: exifData.addIfdData( new IfdData( parser.getCurrentIfd() ) ); break; case ExifParser.EVENT_NEW_TAG: tag = parser.getTag(); parser.registerForTagValue( tag ); if (parser.isDefinedTag(tag.getIfd(), tag.getTagId())) { exifData.getIfdData(tag.getIfd()).setTag(tag); tag = parser.getTag(); if( tag.getDataType() == ExifTag.TYPE_UNDEFINED ) { parser.readFullTagValue( tag );
int endOfTags = mIfdStartOffset + OFFSET_SIZE + TAG_SIZE * mNumOfTagInIfd; if( offset < endOfTags ) { mTag = readTag(); if( mTag == null ) { return next(); checkOffsetOrImageTag( mTag ); long ifdOffset = readUnsignedLong(); if( isIfdRequested( IfdId.TYPE_IFD_1 ) || isThumbnailRequested() ) { if( ifdOffset != 0 ) { registerIfd( IfdId.TYPE_IFD_1, ifdOffset ); long ifdOffset = readUnsignedLong(); if( ifdOffset != 0 ) { Log.w( TAG, "Invalid link to next IFD: " + ifdOffset ); skipTo( entry.getKey() ); } catch( IOException e ) { Log.w( TAG, "Failed to skip to data at: " + entry.getKey() + mNeedToParseOffsetsInCurrentIfd = needToParseOffsetsInCurrentIfd(); if( ( (IfdEvent) event ).isRequested ) { return EVENT_START_OF_IFD; skipRemainingTagsInCurrentIfd(); mTag = tagEvent.tag; if( mTag.getDataType() != ExifTag.TYPE_UNDEFINED ) {
mTag = readTag(); offset += TAG_SIZE; if( mTag == null ) { continue; checkOffsetOrImageTag( mTag ); skipTo( endOfTags ); long ifdOffset = readUnsignedLong(); if( mIfdType == IfdId.TYPE_IFD_0 && ( isIfdRequested( IfdId.TYPE_IFD_1 ) || isThumbnailRequested() ) ) { if( ifdOffset > 0 ) { registerIfd( IfdId.TYPE_IFD_1, ifdOffset );
if( tid == TAG_EXIF_IFD && checkAllowed( ifd, ExifInterface.TAG_EXIF_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_EXIF ) || isIfdRequested( IfdId.TYPE_IFD_INTEROPERABILITY ) ) { registerIfd( IfdId.TYPE_IFD_EXIF, tag.getValueAt( 0 ) ); else if( tid == TAG_GPS_IFD && checkAllowed( ifd, ExifInterface.TAG_GPS_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_GPS ) ) { registerIfd( IfdId.TYPE_IFD_GPS, tag.getValueAt( 0 ) ); else if( tid == TAG_INTEROPERABILITY_IFD && checkAllowed( ifd, ExifInterface.TAG_INTEROPERABILITY_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_INTEROPERABILITY ) ) { registerIfd( IfdId.TYPE_IFD_INTEROPERABILITY, tag.getValueAt( 0 ) ); else if( tid == TAG_JPEG_INTERCHANGE_FORMAT && checkAllowed( ifd, ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT ) ) { if( isThumbnailRequested() ) { registerCompressedImage( tag.getValueAt( 0 ) ); else if( tid == TAG_JPEG_INTERCHANGE_FORMAT_LENGTH && checkAllowed( ifd, ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH ) ) { if( isThumbnailRequested() ) { mJpegSizeTag = tag; else if( tid == TAG_STRIP_OFFSETS && checkAllowed( ifd, ExifInterface.TAG_STRIP_OFFSETS ) ) { if( isThumbnailRequested() ) { if( tag.hasValue() ) { for( int i = 0; i < tag.getComponentCount(); i++ ) { if( tag.getDataType() == ExifTag.TYPE_UNSIGNED_SHORT ) { registerUncompressedStrip( i, tag.getValueAt( i ) ); registerUncompressedStrip( i, tag.getValueAt( i ) );
ExifParser parser = ExifParser.parse( inputStream, options, mInterface ); ExifData exifData = new ExifData( parser.getByteOrder() ); exifData.setSections( parser.getSections() ); exifData.mUncompressedDataPosition = parser.getUncompressedDataPosition(); exifData.setQualityGuess( parser.getQualityGuess() ); exifData.setJpegProcess( parser.getJpegProcess() ); final int w = parser.getImageWidth(); final int h = parser.getImageLength(); int event = parser.next(); while( event != ExifParser.EVENT_END ) { switch( event ) { case ExifParser.EVENT_START_OF_IFD: exifData.addIfdData( new IfdData( parser.getCurrentIfd() ) ); break; case ExifParser.EVENT_NEW_TAG: tag = parser.getTag(); parser.registerForTagValue( tag ); if (parser.isDefinedTag(tag.getIfd(), tag.getTagId())) { exifData.getIfdData(tag.getIfd()).setTag(tag); tag = parser.getTag(); if( tag.getDataType() == ExifTag.TYPE_UNDEFINED ) { parser.readFullTagValue( tag );
int endOfTags = mIfdStartOffset + OFFSET_SIZE + TAG_SIZE * mNumOfTagInIfd; if( offset < endOfTags ) { mTag = readTag(); if( mTag == null ) { return next(); checkOffsetOrImageTag( mTag ); long ifdOffset = readUnsignedLong(); if( isIfdRequested( IfdId.TYPE_IFD_1 ) || isThumbnailRequested() ) { if( ifdOffset != 0 ) { registerIfd( IfdId.TYPE_IFD_1, ifdOffset ); long ifdOffset = readUnsignedLong(); if( ifdOffset != 0 ) { Log.w( TAG, "Invalid link to next IFD: " + ifdOffset ); skipTo( entry.getKey() ); } catch( IOException e ) { Log.w( TAG, "Failed to skip to data at: " + entry.getKey() + mNeedToParseOffsetsInCurrentIfd = needToParseOffsetsInCurrentIfd(); if( ( (IfdEvent) event ).isRequested ) { return EVENT_START_OF_IFD; skipRemainingTagsInCurrentIfd(); mTag = tagEvent.tag; if( mTag.getDataType() != ExifTag.TYPE_UNDEFINED ) {
mTag = readTag(); offset += TAG_SIZE; if( mTag == null ) { continue; checkOffsetOrImageTag( mTag ); skipTo( endOfTags ); long ifdOffset = readUnsignedLong(); if( mIfdType == IfdId.TYPE_IFD_0 && ( isIfdRequested( IfdId.TYPE_IFD_1 ) || isThumbnailRequested() ) ) { if( ifdOffset > 0 ) { registerIfd( IfdId.TYPE_IFD_1, ifdOffset );
if( tid == TAG_EXIF_IFD && checkAllowed( ifd, ExifInterface.TAG_EXIF_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_EXIF ) || isIfdRequested( IfdId.TYPE_IFD_INTEROPERABILITY ) ) { registerIfd( IfdId.TYPE_IFD_EXIF, tag.getValueAt( 0 ) ); else if( tid == TAG_GPS_IFD && checkAllowed( ifd, ExifInterface.TAG_GPS_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_GPS ) ) { registerIfd( IfdId.TYPE_IFD_GPS, tag.getValueAt( 0 ) ); else if( tid == TAG_INTEROPERABILITY_IFD && checkAllowed( ifd, ExifInterface.TAG_INTEROPERABILITY_IFD ) ) { if( isIfdRequested( IfdId.TYPE_IFD_INTEROPERABILITY ) ) { registerIfd( IfdId.TYPE_IFD_INTEROPERABILITY, tag.getValueAt( 0 ) ); else if( tid == TAG_JPEG_INTERCHANGE_FORMAT && checkAllowed( ifd, ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT ) ) { if( isThumbnailRequested() ) { registerCompressedImage( tag.getValueAt( 0 ) ); else if( tid == TAG_JPEG_INTERCHANGE_FORMAT_LENGTH && checkAllowed( ifd, ExifInterface.TAG_JPEG_INTERCHANGE_FORMAT_LENGTH ) ) { if( isThumbnailRequested() ) { mJpegSizeTag = tag; else if( tid == TAG_STRIP_OFFSETS && checkAllowed( ifd, ExifInterface.TAG_STRIP_OFFSETS ) ) { if( isThumbnailRequested() ) { if( tag.hasValue() ) { for( int i = 0; i < tag.getComponentCount(); i++ ) { if( tag.getDataType() == ExifTag.TYPE_UNSIGNED_SHORT ) { registerUncompressedStrip( i, tag.getValueAt( i ) ); registerUncompressedStrip( i, tag.getValueAt( i ) );
/** * Parses the the given InputStream with the given options * * @throws java.io.IOException * @throws ExifInvalidFormatException */ protected static ExifParser parse( InputStream inputStream, int options, ExifInterface iRef ) throws IOException, ExifInvalidFormatException { return new ExifParser( inputStream, options, iRef ); } //