| Method from com.lowagie.text.pdf.codec.TIFFDirectory Detail: |
public TIFFField getField(int tag) {
Integer i = (Integer)fieldIndex.get(new Integer(tag));
if (i == null) {
return null;
} else {
return fields[i.intValue()];
}
}
Returns the value of a given tag as a TIFFField,
or null if the tag is not present. |
public byte getFieldAsByte(int tag) {
return getFieldAsByte(tag, 0);
}
Returns the value of index 0 of a given tag as a
byte. The caller is responsible for ensuring that the tag is
present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
TIFF_UNDEFINED. |
public byte getFieldAsByte(int tag,
int index) {
Integer i = (Integer)fieldIndex.get(new Integer(tag));
byte [] b = fields[i.intValue()].getAsBytes();
return b[index];
}
Returns the value of a particular index of a given tag as a
byte. The caller is responsible for ensuring that the tag is
present and has type TIFFField.TIFF_SBYTE, TIFF_BYTE, or
TIFF_UNDEFINED. |
public double getFieldAsDouble(int tag) {
return getFieldAsDouble(tag, 0);
}
Returns the value of index 0 of a given tag as a double. The
caller is responsible for ensuring that the tag is present and
has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII). |
public double getFieldAsDouble(int tag,
int index) {
Integer i = (Integer)fieldIndex.get(new Integer(tag));
return fields[i.intValue()].getAsDouble(index);
}
Returns the value of a particular index of a given tag as a
double. The caller is responsible for ensuring that the tag is
present and has numeric type (all but TIFF_UNDEFINED and
TIFF_ASCII). |
public float getFieldAsFloat(int tag) {
return getFieldAsFloat(tag, 0);
}
Returns the value of index 0 of a given tag as a float. The
caller is responsible for ensuring that the tag is present and
has numeric type (all but TIFF_UNDEFINED and TIFF_ASCII). |
public float getFieldAsFloat(int tag,
int index) {
Integer i = (Integer)fieldIndex.get(new Integer(tag));
return fields[i.intValue()].getAsFloat(index);
}
Returns the value of a particular index of a given tag as a
float. The caller is responsible for ensuring that the tag is
present and has numeric type (all but TIFF_UNDEFINED and
TIFF_ASCII). |
public long getFieldAsLong(int tag) {
return getFieldAsLong(tag, 0);
}
Returns the value of index 0 of a given tag as a
long. The caller is responsible for ensuring that the tag is
present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG. |
public long getFieldAsLong(int tag,
int index) {
Integer i = (Integer)fieldIndex.get(new Integer(tag));
return fields[i.intValue()].getAsLong(index);
}
Returns the value of a particular index of a given tag as a
long. The caller is responsible for ensuring that the tag is
present and has type TIFF_BYTE, TIFF_SBYTE, TIFF_UNDEFINED,
TIFF_SHORT, TIFF_SSHORT, TIFF_SLONG or TIFF_LONG. |
public TIFFField[] getFields() {
return fields;
}
Returns an array of TIFFFields containing all the fields
in this directory. |
public long getIFDOffset() {
return IFDOffset;
}
Returns the offset of the IFD corresponding to this
TIFFDirectory. |
public long getNextIFDOffset() {
return nextIFDOffset;
}
Returns the offset of the next IFD after the IFD corresponding to this
TIFFDirectory. |
public static int getNumDirectories(RandomAccessFileOrArray stream) throws IOException {
long pointer = stream.getFilePointer(); // Save stream pointer
stream.seek(0L);
int endian = stream.readUnsignedShort();
if (!isValidEndianTag(endian)) {
throw new
IllegalArgumentException("Bad endianness tag (not 0x4949 or 0x4d4d).");
}
boolean isBigEndian = (endian == 0x4d4d);
int magic = readUnsignedShort(stream, isBigEndian);
if (magic != 42) {
throw new
IllegalArgumentException("Bad magic number, should be 42.");
}
stream.seek(4L);
long offset = readUnsignedInt(stream, isBigEndian);
int numDirectories = 0;
while (offset != 0L) {
++numDirectories;
// EOFException means IFD was probably not properly terminated.
try {
stream.seek(offset);
int entries = readUnsignedShort(stream, isBigEndian);
stream.skip(12*entries);
offset = readUnsignedInt(stream, isBigEndian);
} catch(EOFException eof) {
//numDirectories--;
break;
}
}
stream.seek(pointer); // Reset stream pointer
return numDirectories;
}
Returns the number of image directories (subimages) stored in a
given TIFF file, represented by a SeekableStream. |
public int getNumEntries() {
return numEntries;
}
Returns the number of directory entries. |
public int[] getTags() {
int[] tags = new int[fieldIndex.size()];
Enumeration e = fieldIndex.keys();
int i = 0;
while (e.hasMoreElements()) {
tags[i++] = ((Integer)e.nextElement()).intValue();
}
return tags;
}
Returns an ordered array of ints indicating the tag
values. |
public boolean isBigEndian() {
return isBigEndian;
}
Returns a boolean indicating whether the byte order used in the
the TIFF file is big-endian (i.e. whether the byte order is from
the most significant to the least significant) |
public boolean isTagPresent(int tag) {
return fieldIndex.containsKey(new Integer(tag));
}
Returns true if a tag appears in the directory. |