/** * Gets the value or null if none exists. If there are more than 1 longs in * this value, gets the first one. This method should be used for tags of * type {@link #TYPE_UNSIGNED_LONG}. * * @param defaultValue the long to return if tag's value does not exist or * cannot be converted to a long. * @return the tag's value as a long, or the defaultValue. */ public long getValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l == null || l.length < 1 ) { return defaultValue; } return l[0]; }
/** * Gets the value or null if none exists. If there are more than 1 longs in * this value, gets the first one. This method should be used for tags of * type {@link #TYPE_UNSIGNED_LONG}. * * @param defaultValue the long to return if tag's value does not exist or * cannot be converted to a long. * @return the tag's value as a long, or the defaultValue. */ public long getValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l == null || l.length < 1 ) { return defaultValue; } return l[0]; }
/** * @see #getTagValue */ public long[] getTagLongValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsLongs(); }
/** * @see #getTagValue */ public long[] getTagLongValues( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return null; } return t.getValueAsLongs(); }
/** * Gets a long representation of the value. * * @param defaultValue value to return if there is no value or value is a * rational with a denominator of 0. * @return the tag's value as a long, or defaultValue if no representation * exists. */ public long forceGetValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l != null && l.length >= 1 ) { return l[0]; } byte[] b = getValueAsBytes(); if( b != null && b.length >= 1 ) { return b[0]; } Rational[] r = getValueAsRationals(); if( r != null && r.length >= 1 && r[0].getDenominator() != 0 ) { return (long) r[0].toDouble(); } return defaultValue; }
/** * Gets a long representation of the value. * * @param defaultValue value to return if there is no value or value is a * rational with a denominator of 0. * @return the tag's value as a long, or defaultValue if no representation * exists. */ public long forceGetValueAsLong( long defaultValue ) { long[] l = getValueAsLongs(); if( l != null && l.length >= 1 ) { return l[0]; } byte[] b = getValueAsBytes(); if( b != null && b.length >= 1 ) { return b[0]; } Rational[] r = getValueAsRationals(); if( r != null && r.length >= 1 && r[0].getDenominator() != 0 ) { return (long) r[0].toDouble(); } return defaultValue; }