/** * Returns a list of all {@link ExifTag}s in the ExifData or null if there * are none. */ protected List<ExifTag> getAllTags() { ArrayList<ExifTag> ret = new ArrayList<ExifTag>(); for( IfdData d : mIfdDatas ) { if( d != null ) { ExifTag[] tags = d.getAllTags(); if( tags != null ) { for( ExifTag t : tags ) { ret.add( t ); } } } } if( ret.size() == 0 ) { return null; } return ret; }
/** * Returns a list of all {@link ExifTag}s in a given IFD or null if there * are none. */ protected List<ExifTag> getAllTagsForIfd( int ifd ) { IfdData d = mIfdDatas[ifd]; if( d == null ) { return null; } ExifTag[] tags = d.getAllTags(); if( tags == null ) { return null; } ArrayList<ExifTag> ret = new ArrayList<ExifTag>( tags.length ); for( ExifTag t : tags ) { ret.add( t ); } if( ret.size() == 0 ) { return null; } return ret; }
/** * Returns a list of all {@link ExifTag}s in the ExifData or null if there * are none. */ protected List<ExifTag> getAllTags() { ArrayList<ExifTag> ret = new ArrayList<ExifTag>(); for( IfdData d : mIfdDatas ) { if( d != null ) { ExifTag[] tags = d.getAllTags(); if( tags != null ) { for( ExifTag t : tags ) { ret.add( t ); } } } } if( ret.size() == 0 ) { return null; } return ret; }
/** * Returns a list of all {@link ExifTag}s in a given IFD or null if there * are none. */ protected List<ExifTag> getAllTagsForIfd( int ifd ) { IfdData d = mIfdDatas[ifd]; if( d == null ) { return null; } ExifTag[] tags = d.getAllTags(); if( tags == null ) { return null; } ArrayList<ExifTag> ret = new ArrayList<ExifTag>( tags.length ); for( ExifTag t : tags ) { ret.add( t ); } if( ret.size() == 0 ) { return null; } return ret; }
private int calculateOffsetOfIfd( IfdData ifd, int offset ) { offset += 2 + ifd.getTagCount() * TAG_SIZE + 4; ExifTag[] tags = ifd.getAllTags(); for( ExifTag tag : tags ) { if( tag.getDataSize() > 4 ) { tag.setOffset( offset ); offset += tag.getDataSize(); } } return offset; }
private int calculateOffsetOfIfd( IfdData ifd, int offset ) { offset += 2 + ifd.getTagCount() * TAG_SIZE + 4; ExifTag[] tags = ifd.getAllTags(); for( ExifTag tag : tags ) { if( tag.getDataSize() > 4 ) { tag.setOffset( offset ); offset += tag.getDataSize(); } } return offset; }
/** * Returns true if all tags in this two IFDs are equal. Note that tags of * IFDs offset or thumbnail offset will be ignored. */ @Override public boolean equals( Object obj ) { if( this == obj ) { return true; } if( obj == null ) { return false; } if( obj instanceof IfdData ) { IfdData data = (IfdData) obj; if( data.getId() == mIfdId && data.getTagCount() == getTagCount() ) { ExifTag[] tags = data.getAllTags(); for( ExifTag tag : tags ) { if( ExifInterface.isOffsetTag( tag.getTagId() ) ) { continue; } ExifTag tag2 = mExifTags.get( tag.getTagId() ); if( ! tag.equals( tag2 ) ) { return false; } } return true; } } return false; }
/** * Returns true if all tags in this two IFDs are equal. Note that tags of * IFDs offset or thumbnail offset will be ignored. */ @Override public boolean equals( Object obj ) { if( this == obj ) { return true; } if( obj == null ) { return false; } if( obj instanceof IfdData ) { IfdData data = (IfdData) obj; if( data.getId() == mIfdId && data.getTagCount() == getTagCount() ) { ExifTag[] tags = data.getAllTags(); for( ExifTag tag : tags ) { if( ExifInterface.isOffsetTag( tag.getTagId() ) ) { continue; } ExifTag tag2 = mExifTags.get( tag.getTagId() ); if( ! tag.equals( tag2 ) ) { return false; } } return true; } } return false; }
private void writeIfd( IfdData ifd, OrderedDataOutputStream dataOutputStream ) throws IOException { ExifTag[] tags = ifd.getAllTags(); dataOutputStream.writeShort( (short) tags.length ); for( ExifTag tag : tags ) { dataOutputStream.writeShort( tag.getTagId() ); dataOutputStream.writeShort( tag.getDataType() ); dataOutputStream.writeInt( tag.getComponentCount() ); // Log.v( TAG, "\n" + tag.toString() ); if( tag.getDataSize() > 4 ) { dataOutputStream.writeInt( tag.getOffset() ); } else { ExifOutputStream.writeTagValue( tag, dataOutputStream ); for( int i = 0, n = 4 - tag.getDataSize(); i < n; i++ ) { dataOutputStream.write( 0 ); } } } dataOutputStream.writeInt( ifd.getOffsetToNextIfd() ); for( ExifTag tag : tags ) { if( tag.getDataSize() > 4 ) { ExifOutputStream.writeTagValue( tag, dataOutputStream ); } } }
private void writeIfd( IfdData ifd, OrderedDataOutputStream dataOutputStream ) throws IOException { ExifTag[] tags = ifd.getAllTags(); dataOutputStream.writeShort( (short) tags.length ); for( ExifTag tag : tags ) { dataOutputStream.writeShort( tag.getTagId() ); dataOutputStream.writeShort( tag.getDataType() ); dataOutputStream.writeInt( tag.getComponentCount() ); // Log.v( TAG, "\n" + tag.toString() ); if( tag.getDataSize() > 4 ) { dataOutputStream.writeInt( tag.getOffset() ); } else { ExifOutputStream.writeTagValue( tag, dataOutputStream ); for( int i = 0, n = 4 - tag.getDataSize(); i < n; i++ ) { dataOutputStream.write( 0 ); } } } dataOutputStream.writeInt( ifd.getOffsetToNextIfd() ); for( ExifTag tag : tags ) { if( tag.getDataSize() > 4 ) { ExifOutputStream.writeTagValue( tag, dataOutputStream ); } } }