/** * Gets the number of elements for an ExifTag in a given IFD. * * @param tagId a defined tag constant, e.g. {@link #TAG_IMAGE_WIDTH}. * @param ifdId the IFD containing the ExifTag to check. * @return the number of elements in the ExifTag, if the tag's size is * undefined this will return the actual number of elements that is * in the ExifTag's value. */ @SuppressWarnings( "unused" ) public int getActualTagCount( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return 0; } return t.getComponentCount(); }
/** * Gets the number of elements for an ExifTag in a given IFD. * * @param tagId a defined tag constant, e.g. {@link #TAG_IMAGE_WIDTH}. * @param ifdId the IFD containing the ExifTag to check. * @return the number of elements in the ExifTag, if the tag's size is * undefined this will return the actual number of elements that is * in the ExifTag's value. */ @SuppressWarnings( "unused" ) public int getActualTagCount( int tagId, int ifdId ) { ExifTag t = getTag( tagId, ifdId ); if( t == null ) { return 0; } return t.getComponentCount(); }
/** * Gets the total data size in bytes of the value of this tag. */ public int getDataSize() { return getComponentCount() * getElementSize( getDataType() ); }
/** * Gets the total data size in bytes of the value of this tag. */ public int getDataSize() { return getComponentCount() * getElementSize( getDataType() ); }
return null; if( tag.getComponentCount() < 8 ) { return null; byte[] buf = new byte[tag.getComponentCount()]; tag.getBytes( buf );
return null; if( tag.getComponentCount() < 8 ) { return null; byte[] buf = new byte[tag.getComponentCount()]; tag.getBytes( buf );
@SuppressWarnings( "unused" ) protected int getTagDefinitionForTag( ExifTag tag ) { short type = tag.getDataType(); int count = tag.getComponentCount(); int ifd = tag.getIfd(); return getTagDefinitionForTag( tag.getTagId(), type, count, ifd ); }
@SuppressWarnings( "unused" ) protected int getTagDefinitionForTag( ExifTag tag ) { short type = tag.getDataType(); int count = tag.getComponentCount(); int ifd = tag.getIfd(); return getTagDefinitionForTag( tag.getTagId(), type, count, ifd ); }
case ExifTag.TYPE_ASCII: byte buf[] = tag.getStringByte(); if( buf.length == tag.getComponentCount() ) { buf[buf.length - 1] = 0; dataOutputStream.write( buf ); case ExifTag.TYPE_LONG: case ExifTag.TYPE_UNSIGNED_LONG: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeInt( (int) tag.getValueAt( i ) ); case ExifTag.TYPE_RATIONAL: case ExifTag.TYPE_UNSIGNED_RATIONAL: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeRational( tag.getRational( i ) ); case ExifTag.TYPE_UNDEFINED: case ExifTag.TYPE_UNSIGNED_BYTE: buf = new byte[tag.getComponentCount()]; tag.getBytes( buf ); dataOutputStream.write( buf ); break; case ExifTag.TYPE_UNSIGNED_SHORT: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeShort( (short) tag.getValueAt( i ) );
case ExifTag.TYPE_ASCII: byte buf[] = tag.getStringByte(); if( buf.length == tag.getComponentCount() ) { buf[buf.length - 1] = 0; dataOutputStream.write( buf ); case ExifTag.TYPE_LONG: case ExifTag.TYPE_UNSIGNED_LONG: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeInt( (int) tag.getValueAt( i ) ); case ExifTag.TYPE_RATIONAL: case ExifTag.TYPE_UNSIGNED_RATIONAL: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeRational( tag.getRational( i ) ); case ExifTag.TYPE_UNDEFINED: case ExifTag.TYPE_UNSIGNED_BYTE: buf = new byte[tag.getComponentCount()]; tag.getBytes( buf ); dataOutputStream.write( buf ); break; case ExifTag.TYPE_UNSIGNED_SHORT: for( int i = 0, n = tag.getComponentCount(); i < n; i++ ) { dataOutputStream.writeShort( (short) tag.getValueAt( i ) );
protected void readFullTagValue( final ExifTag tag ) throws IOException { final int componentCount = tag.getComponentCount(); int size = tag.getComponentCount(); if( mCorrespondingEvent.size() > 0 ) { if( mCorrespondingEvent.firstEntry().getKey() < mTiffStream.getReadByteCount() + size ) {
protected void readFullTagValue( final ExifTag tag ) throws IOException { final int componentCount = tag.getComponentCount(); int size = tag.getComponentCount(); if( mCorrespondingEvent.size() > 0 ) { if( mCorrespondingEvent.firstEntry().getKey() < mTiffStream.getReadByteCount() + size ) {
if( tag.getComponentCount() == 0 ) { return; 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 ) );
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 ); } } }
if( tag.getComponentCount() == 0 ) { return; 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 ) );