/** * Gets an ExifTag for an IFD other than the tag's default. * * @see #getTag */ public ExifTag getTag( int tagId, int ifdId ) { if( ! ExifTag.isValidIfd( ifdId ) ) { return null; } return mData.getTag( getTrueTagKey( tagId ), ifdId ); }
/** * Adds the given ExifTag to the given IFD and returns an existing ExifTag * with the same TID or null if none exist. */ protected ExifTag addTag( ExifTag tag, int ifdId ) { if( tag != null && ExifTag.isValidIfd( ifdId ) ) { IfdData ifdData = getOrCreateIfdData( ifdId ); return ifdData.setTag( tag ); } return null; }
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; }
public OrderedDataOutputStream writeRational( Rational rational ) throws IOException { writeInt( (int) rational.getNumerator() ); writeInt( (int) rational.getDenominator() ); return this; }
/** * @see #getTagValue */ public Rational[] getTagRationalValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsRationals(); }
/** * @see #getTagValue */ public byte[] getTagByteValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsBytes(); }
/** * @see #getTagValue */ public long[] getTagLongValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsLongs(); }
/** * Removes the ExifTag for a tag constant from the given IFD. * * @param tagId a tag constant, e.g. {@link #TAG_IMAGE_WIDTH}. * @param ifdId the IFD of the ExifTag to remove. */ public void deleteTag( int tagId, int ifdId ) { mData.removeTag( getTrueTagKey( tagId ), ifdId ); }
/** * @see #getTagValue */ public int[] getTagIntValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsInts(); }
protected static boolean isIfdAllowed( int info, int ifd ) { int[] ifds = IfdData.getIfds(); int ifdFlags = getAllowedIfdFlagsFromInfo( info ); for( int i = 0; i < ifds.length; i++ ) { if( ifd == ifds[i] && ( ( ifdFlags >> i ) & 1 ) == 1 ) { return true; } } return false; }
/** * Reads value of type {@link ExifTag#TYPE_UNSIGNED_RATIONAL} from the * InputStream. */ protected Rational readUnsignedRational() throws IOException { long nomi = readUnsignedLong(); long denomi = readUnsignedLong(); return new Rational( nomi, denomi ); }
/** * @see #getTagValue */ public Rational getTagRationalValue( int tagId, int ifdId ) { Rational[] l = getTagRationalValues( tagId, ifdId ); if( l == null || l.length == 0 ) { return null; } return new Rational( l[0] ); }
/** * Gets an ExifTag for an IFD other than the tag's default. * * @see #getTag */ public ExifTag getTag( int tagId, int ifdId ) { if( ! ExifTag.isValidIfd( ifdId ) ) { return null; } return mData.getTag( getTrueTagKey( tagId ), ifdId ); }
/** * Adds the given ExifTag to the given IFD and returns an existing ExifTag * with the same TID or null if none exist. */ protected ExifTag addTag( ExifTag tag, int ifdId ) { if( tag != null && ExifTag.isValidIfd( ifdId ) ) { IfdData ifdData = getOrCreateIfdData( ifdId ); return ifdData.setTag( tag ); } return null; }
public OrderedDataOutputStream writeRational( Rational rational ) throws IOException { writeInt( (int) rational.getNumerator() ); writeInt( (int) rational.getDenominator() ); return this; }
protected static boolean isIfdAllowed( int info, int ifd ) { int[] ifds = IfdData.getIfds(); int ifdFlags = getAllowedIfdFlagsFromInfo( info ); for( int i = 0; i < ifds.length; i++ ) { if( ifd == ifds[i] && ( ( ifdFlags >> i ) & 1 ) == 1 ) { return true; } } return false; }