- All Implemented Interfaces:
Closeable,AutoCloseable
References:
TIFF TM Revision 6.0. Final — June 3, 1992. Adobe Systems Inc. http://www.exif.org/specifications.html
- Author:
- Werner Randelshofer
-
Constructor Summary
ConstructorsConstructorDescriptionTIFFInputStream(ImageInputStream in, ByteOrder byteOrder, long firstIFDOffset) Creates a TIFFInputStream from a stream which does not have a header. -
Method Summary
Modifier and TypeMethodDescriptionlongintread()intread(byte[] b, int off, int len) intread(long offset, byte[] b, int off, int len) readASCII(long offset, long length) Reads an ASCII (8-bit byte that contains a 7-bit ASCII code; the last byte must be NUL (binary zero).readIFD(long offset) Reads the IFD at the specified offset.readIFD(long offset, boolean hasNextOffset, boolean isFirstIFD) Reads the IFD at the specified offset.longreadLONG(long offset) Reads a LONG (32-bit (4-byte) unsigned integer).long[]readLONG(long offset, long count) Reads the specified number of LONGs (32-bit (4-byte) unsigned integer).readRATIONAL(long offset) Reads a RATIONAL number at the specified offset.Rational[]readRATIONAL(long offset, long count) Reads the specified number of RATIONALs at the specified offset.int[]readSHORT(long offset, long count) Reads the specified number of SHORTs (16-bit (2-byte) unsigned integer).intreadSLONG(long offset) Reads a SLONG (32-bit (4-byte) signed integer).int[]readSLONG(long offset, long count) Reads the specified number of SLONGs (32-bit (4-byte) signed integer).readSRATIONAL(long offset) Reads a RATIONAL number at the specified offset.Rational[]readSRATIONAL(long offset, long count) Reads the specified number of RATIONALs at the specified offset.short[]readSSHORT(long offset, long count) Reads the specified number of SSHORTs (16-bit (2-byte) signed integer).voidsetByteOrder(ByteOrder newValue) Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Constructor Details
-
TIFFInputStream
- Throws:
IOException
-
TIFFInputStream
Creates a TIFFInputStream from a stream which does not have a header.
-
-
Method Details
-
getByteOrder
-
setByteOrder
-
getFirstIFDOffset
public long getFirstIFDOffset() -
readIFD
Reads the IFD at the specified offset.An IFD consists of a 2-byte count of the number of directory entries (i.e., the number of fields), followed by a sequence of 12-byte field entries, followed by a 4-byte offset of the next IFD (or 0 if none).
Each 12-byte IFD entry has the following format: Bytes 0-1 The Tag that identifies the field. Bytes 2-3 The field Type. Bytes 4-7 The number of values, Count of the indicated Type. Bytes 8-11 The Value Offset, the file offset (in bytes) of the Value for the field. The Value is expected to begin on a word boundary; the corresponding Value Offset will thus be an even number. This file offset may point anywhere in the file, even after the image data.
There must be at least 1 IFD in a TIFF file and each IFD must have at least one entry.
- Throws:
IOException
-
readIFD
Reads the IFD at the specified offset.An IFD consists of a 2-byte count of the number of directory entries (i.e., the number of fields), followed by a sequence of 12-byte field entries, followed by a 4-byte offset of the next IFD (or 0 if none).
Each 12-byte IFD entry has the following format: Bytes 0-1 The Tag that identifies the field. Bytes 2-3 The field Type. Bytes 4-7 The number of values, Count of the indicated Type. Bytes 8-11 The Value Offset, the file offset (in bytes) of the Value for the field. The Value is expected to begin on a word boundary; the corresponding Value Offset will thus be an even number. This file offset may point anywhere in the file, even after the image data.
There must be at least 1 IFD in a TIFF file and each IFD must have at least one entry.
- Throws:
IOException
-
readASCII
Reads an ASCII (8-bit byte that contains a 7-bit ASCII code; the last byte must be NUL (binary zero). value at the specified offset.- Throws:
IOException
-
readLONG
Reads a LONG (32-bit (4-byte) unsigned integer). value at the specified offset.- Throws:
IOException
-
readLONG
Reads the specified number of LONGs (32-bit (4-byte) unsigned integer). value at the specified offset.- Throws:
IOException
-
readSLONG
Reads a SLONG (32-bit (4-byte) signed integer). value at the specified offset.- Throws:
IOException
-
readSLONG
Reads the specified number of SLONGs (32-bit (4-byte) signed integer). value at the specified offset.- Throws:
IOException
-
readSHORT
Reads the specified number of SHORTs (16-bit (2-byte) unsigned integer). value at the specified offset.- Throws:
IOException
-
readSSHORT
Reads the specified number of SSHORTs (16-bit (2-byte) signed integer). value at the specified offset.- Throws:
IOException
-
readRATIONAL
Reads a RATIONAL number at the specified offset.- Throws:
IOException
-
readSRATIONAL
Reads a RATIONAL number at the specified offset.- Throws:
IOException
-
readRATIONAL
Reads the specified number of RATIONALs at the specified offset.- Throws:
IOException
-
readSRATIONAL
Reads the specified number of RATIONALs at the specified offset.- Throws:
IOException
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
read
- Throws:
IOException
-