Package net.sourceforge.jiu.codecs.tiff
Class TIFFTag
- java.lang.Object
-
- net.sourceforge.jiu.codecs.tiff.TIFFTag
-
- All Implemented Interfaces:
TIFFConstants
public class TIFFTag extends Object implements TIFFConstants
This encapsulates the data stored in a TIFF tag (a single image file directory entry). That includes the following items:- identification number, 254 or higher; see the many TAG_xyz constants in
TIFFConstants
for a list of allowed values - type; the allowed types include integer and floating point numbers, Strings etc.;
see the TAG_TYPE_xyz constants in
TIFFConstants
- count; the number of values of the given type that are stored in this tag; 1 or higher
- offset; if count is 1 and the type fits into four bytes, this is the complete value of this tag; otherwise, it is an offset into the file to the position that will hold the value(s)
TIFFCodec
for more details.- Author:
- Marco Schmidt
- See Also:
TIFFImageFileDirectory
-
-
Field Summary
Fields Modifier and Type Field Description private int
count
private int
id
private Vector
objects
private int
offset
private int
type
-
Fields inherited from interface net.sourceforge.jiu.codecs.tiff.TIFFConstants
COMPRESSION_CCITT_GROUP3_1D_MODIFIED_HUFFMAN, COMPRESSION_CCITT_T4, COMPRESSION_CCITT_T6, COMPRESSION_DEFLATED_INOFFICIAL, COMPRESSION_DEFLATED_OFFICIAL, COMPRESSION_JBIG, COMPRESSION_JBIG2, COMPRESSION_JPEG_6_0, COMPRESSION_JPEG_POST_6_0, COMPRESSION_LZW, COMPRESSION_NEXT, COMPRESSION_NONE, COMPRESSION_NONE_WORD_ALIGNED, COMPRESSION_PACKBITS, COMPRESSION_SGI_LOG_24_PACKED, COMPRESSION_SGI_LOG_RLE, COMPRESSION_THUNDERSCAN, PHOTOMETRIC_BLACK_IS_ZERO, PHOTOMETRIC_LOGL, PHOTOMETRIC_PALETTED, PHOTOMETRIC_TRUECOLOR_CMYK, PHOTOMETRIC_TRUECOLOR_LOGLUV, PHOTOMETRIC_TRUECOLOR_RGB, PHOTOMETRIC_WHITE_IS_ZERO, PLANAR_CONFIGURATION_CHUNKY, PLANAR_CONFIGURATION_PLANAR, TAG_ARTIST, TAG_BAD_FAX_LINES, TAG_BITS_PER_SAMPLE, TAG_CELL_LENGTH, TAG_CELL_WIDTH, TAG_CLEAN_FAX_DATA, TAG_COLOR_MAP, TAG_COMPRESSION, TAG_CONSECUTIVE_BAD_FAX_LINES, TAG_COPYRIGHT, TAG_DATE_TIME, TAG_DOCUMENT_NAME, TAG_EXTRA_SAMPLES, TAG_FILL_ORDER, TAG_FREE_BYTE_COUNTS, TAG_FREE_OFFSETS, TAG_GRAY_RESPONSE_CURVE, TAG_GRAY_RESPONSE_UNIT, TAG_HOST_COMPUTER, TAG_IMAGE_DESCRIPTION, TAG_IMAGE_LENGTH, TAG_IMAGE_WIDTH, TAG_LENGTH, TAG_MAKE, TAG_MAX_SAMPLE_VALUE, TAG_MIN_SAMPLE_VALUE, TAG_MODEL, TAG_NEW_SUBFILE_TYPE, TAG_ORIENTATION, TAG_PHOTOMETRIC_INTERPRETATION, TAG_PHOTOSHOP_IMAGE_RESOURCES, TAG_PLANAR_CONFIGURATION, TAG_PREDICTOR, TAG_RESOLUTION_UNIT, TAG_RESOLUTION_X, TAG_RESOLUTION_Y, TAG_ROWS_PER_STRIP, TAG_SAMPLES_PER_PIXEL, TAG_SOFTWARE, TAG_STRIP_BYTE_COUNTS, TAG_STRIP_OFFSETS, TAG_T4_OPTIONS, TAG_T6_OPTIONS, TAG_TILE_BYTE_COUNTS, TAG_TILE_HEIGHT, TAG_TILE_OFFSETS, TAG_TILE_WIDTH, TAG_TYPE_ASCII, TAG_TYPE_BYTE, TAG_TYPE_DOUBLE, TAG_TYPE_FLOAT, TAG_TYPE_LONG, TAG_TYPE_RATIONAL, TAG_TYPE_SBYTE, TAG_TYPE_SHORT, TAG_TYPE_SLONG, TAG_TYPE_SRATIONAL, TAG_TYPE_SSHORT, TAG_TYPE_UNDEFINED
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getCount()
Returns the number of items stored in this tag.int
getElementAsInt(int index)
Returns an item stored in this tag anint
value.int
getId()
Returns the ID of this tag, which may be one of the TAG_xyz constants.Object
getObject(int index)
Returns an object from this tag's Vector of items, ornull
if no such Vector exists.int
getOffset()
Returns the offset value stored in this tag.String
getString()
If this tag has a Vector of items and if the first item is a String, that String is returned,null
otherwise.int
getType()
Returns the type of this tag's content as a TAG_TYPE_xyz constant.Vector
getVector()
Returns the Vector encapsulating the items stored in this tag.boolean
isInt()
Returns if the value(s) stored in this tag are of type BYTE, SHORT or LONG.void
setVector(Vector vector)
If this tag encapsulates more than one item or a single item that does not fit into four bytes, this Vector will store all elements in it.
-
-
-
Field Detail
-
id
private int id
-
type
private int type
-
count
private int count
-
offset
private int offset
-
objects
private Vector objects
-
-
Constructor Detail
-
TIFFTag
public TIFFTag(int id, int type, int count, int offset)
Creates a new tag with the given ID, type, number of objects / primitives stored in it and offset value.
-
TIFFTag
public TIFFTag(int id, int type, int count, int offset, Vector vector)
-
-
Method Detail
-
getCount
public int getCount()
Returns the number of items stored in this tag.
-
getElementAsInt
public int getElementAsInt(int index)
Returns an item stored in this tag anint
value.- Parameters:
index
- zero-based index of the integer item to be returned
-
getId
public int getId()
Returns the ID of this tag, which may be one of the TAG_xyz constants.
-
getObject
public Object getObject(int index)
Returns an object from this tag's Vector of items, ornull
if no such Vector exists.
-
getOffset
public int getOffset()
Returns the offset value stored in this tag.
-
getString
public String getString()
If this tag has a Vector of items and if the first item is a String, that String is returned,null
otherwise.
-
getType
public int getType()
Returns the type of this tag's content as a TAG_TYPE_xyz constant.
-
getVector
public Vector getVector()
Returns the Vector encapsulating the items stored in this tag.- See Also:
setVector(java.util.Vector)
-
isInt
public boolean isInt()
Returns if the value(s) stored in this tag are of type BYTE, SHORT or LONG. Note that BYTE and SHORT have the same meaning as in Java (one and two bytes large) while LONG is a 32-bit-value, just likeint
in Java.- Returns:
- if this tag's contains integer values <= 32 bits
-
setVector
public void setVector(Vector vector)
If this tag encapsulates more than one item or a single item that does not fit into four bytes, this Vector will store all elements in it. The size() method called on that Vector object returns the same value as getCount().- Parameters:
vector
- the Vector with the items to be encapsulated by this tag- See Also:
getVector()
-
-