rebuild.graphics.tiff
Class IFD

java.lang.Object
  extended by rebuild.graphics.tiff.IFD

public final class IFD
extends java.lang.Object

An "Image File Directory" that defines characteristics about the TIFF image.

Since:
BBX 1.0.1

Constructor Summary
IFD()
          Create a new IFD.
 
Method Summary
 void addTag(Tag tag)
          Add a new Tag to the this IFD.
 void clear()
          Clear all tags from the IFD.
 int getBigLength()
          Get the number of bytes the tags in this IFD takes up when in BigTIFF format.
 int getCount()
          Get the number of tags in this IFD.
 int getLength()
          Get the number of bytes the tags in this IFD takes up.
 int getOptBigLength()
          Used internally, not for public use.
 int getOptLength()
          Used internally, not for public use.
 Tag getTag(int index)
          Get a tag at the specified index.
 Tag getTagByType(int type)
          Get a tag by the type.
 int indexOf(int type)
          Get the index of a tag of the specified type.
 int indexOf(int type, int startingIndex)
          Get the index of a tag of the specified type.
 void insertTag(int index, Tag tag)
          Insert a tag at the specified index.
 void removeTag(int index)
          Remove a tag at the specified index.
 void sort()
          Sort the tags into a manner that is required by the TIFF specification.
 int write(Writer dat, int dataOffset)
          Write the IFD.
 int write(Writer dat, int offset, int dataOffset)
          Write the IFD.
 long write(Writer dat, long offset, long dataOffset, boolean big)
          Write the IFD.
 long writeBig(Writer dat, long dataOffset)
          Write the IFD.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IFD

public IFD()
Create a new IFD.

Method Detail

addTag

public void addTag(Tag tag)
Add a new Tag to the this IFD. It is recommended to only add a tag once.

Parameters:
tag - The Tag to add.

removeTag

public void removeTag(int index)
Remove a tag at the specified index.

Parameters:
index - The index to remove the tag at.

clear

public void clear()
Clear all tags from the IFD.


getTag

public Tag getTag(int index)
Get a tag at the specified index.

Parameters:
index - The index to get the tag from.
Returns:
The tag at the specified index.

getTagByType

public Tag getTagByType(int type)
Get a tag by the type.

Parameters:
type - The type of tag to get.
Returns:
The tag of the specified type, or null if one does not exist.

indexOf

public int indexOf(int type)
Get the index of a tag of the specified type.

Parameters:
type - The type of tag to get the index of.
Returns:
The index of the tag of the specified type or -1 if one does not exist.

indexOf

public int indexOf(int type,
                   int startingIndex)
Get the index of a tag of the specified type.

Parameters:
type - The type of tag to get the index of.
startingIndex - The starting index of the search.
Returns:
The index of the tag of the specified type or -1 if one does not exist.

insertTag

public void insertTag(int index,
                      Tag tag)
Insert a tag at the specified index.

Parameters:
index - The index to place the tag at.
tag - The tag to place, if this is null then it will be ignored.

getCount

public int getCount()
Get the number of tags in this IFD.

Returns:
The number of tags in this IFD.

getLength

public int getLength()
Get the number of bytes the tags in this IFD takes up.

Returns:
The number of bytes the tags only take up.

getBigLength

public int getBigLength()
Get the number of bytes the tags in this IFD takes up when in BigTIFF format.

Returns:
The number of bytes the tags only take up.

getOptLength

public int getOptLength()
Used internally, not for public use.


getOptBigLength

public int getOptBigLength()
Used internally, not for public use.


sort

public void sort()
Sort the tags into a manner that is required by the TIFF specification. This is a time consuming operation and should only be done when absolutely necessary.


write

public int write(Writer dat,
                 int dataOffset)
          throws java.io.IOException
Write the IFD. The default offset to the next IFD is 0.

Parameters:
dat - The rebuild.Graphics.tiff.tags.Writer to write the IFD to.
dataOffset - The absolute position to write any extra data to.
Returns:
The absolute end position after the IFD and extra data.
Throws:
java.io.IOException - If any IO exception occurs.

write

public int write(Writer dat,
                 int offset,
                 int dataOffset)
          throws java.io.IOException
Write the IFD.

Parameters:
dat - The rebuild.Graphics.tiff.tags.Writer to write the IFD to.
offset - The offset to the next IFD.
dataOffset - The absolute position to write any extra data to.
Returns:
The absolute end position after the IFD and extra data.
Throws:
java.io.IOException - If any IO exception occurs.

writeBig

public long writeBig(Writer dat,
                     long dataOffset)
              throws java.io.IOException
Write the IFD. The default offset to the next IFD is 0.

Parameters:
dat - The rebuild.Graphics.tiff.tags.Writer to write the IFD to.
dataOffset - The absolute position to write any extra data to.
Returns:
The absolute end position after the IFD and extra data.
Throws:
java.io.IOException - If any IO exception occurs.

write

public long write(Writer dat,
                  long offset,
                  long dataOffset,
                  boolean big)
           throws java.io.IOException
Write the IFD.

Parameters:
dat - The rebuild.Graphics.tiff.tags.Writer to write the IFD to.
offset - The offset to the next IFD.
dataOffset - The absolute position to write any extra data to.
big - If this is writing a BigTIFF.
Returns:
The absolute end position after the IFD and extra data.
Throws:
java.io.IOException - If any IO exception occurs.