public class XTIFFDirectory
extends java.lang.Object
implements java.io.Serializable
XTIFFDescriptor.register()
method, each XTIFF image will
possess a property called "tiff.directory" which will be
an object of the type created by the factory. The class is
declared as serializable to permit its transmission to remote
images as a set of parameters to the codec, and to be able
to survive as an instantiated property of the RenderedImage.XTIFFDescriptor
,
XTIFFField
,
XTIFFTileCodec
,
XTIFFFactory
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected static XTIFFFactory |
factory
default directory factory
|
protected com.sun.media.jai.codec.SeekableStream |
stream
The stream being read.
|
protected static java.util.Hashtable |
tileCodecs |
Modifier | Constructor and Description |
---|---|
|
XTIFFDirectory()
The default constructor.
|
protected |
XTIFFDirectory(com.sun.media.jai.codec.SeekableStream stream,
int directory)
Constructs a XTIFFDirectory from a SeekableStream.
|
protected |
XTIFFDirectory(com.sun.media.jai.codec.SeekableStream stream,
long ifd_offset)
Constructs a XTIFFDirectory by reading a SeekableStream.
|
Modifier and Type | Method and Description |
---|---|
void |
addField(int tag,
int type,
int count,
java.lang.Object obj)
Create and add a TIFF field to this directory.
|
void |
addField(XTIFFField field)
Add an existing TIFF field to this directory.
|
static XTIFFDirectory |
create()
Constructs an XTIFFDirectory from the currently.
|
static XTIFFDirectory |
create(com.sun.media.jai.codec.SeekableStream stream,
int directory)
Constructs a XTIFFDirectory from a SeekableStream.
|
static XTIFFDirectory |
create(com.sun.media.jai.codec.SeekableStream stream,
long ifd_offset)
Constructs a TIFFDirectory by reading a SeekableStream.
|
static XTIFFField |
createField(int tag,
int type,
int count,
java.lang.Object obj)
Create a TIFF field
|
XTIFFTileCodec |
createTileCodec(XTIFFDecodeParam param)
Constructs a tile codec for decoding data, using the
compression defined in the current directory.
|
XTIFFTileCodec |
createTileCodec(XTIFFEncodeParam param)
Constructs a tile codec for encoding data, using the
compression defined in the current directory.
|
int |
getCompression()
Return the type of compression indicated in the
TIFF fields, or XTIFF.COMPRESSION_NON if not
specified.
|
XTIFFField |
getField(int tag)
Returns the value of a given tag as a XTIFFField,
or null if the tag is not present.
|
byte |
getFieldAsByte(int tag)
Returns the value of index 0 of a given tag as a
byte.
|
byte |
getFieldAsByte(int tag,
int index)
Returns the value of a particular index of a given tag as a
byte.
|
double |
getFieldAsDouble(int tag)
Returns the value of index 0 of a given tag as a double.
|
double |
getFieldAsDouble(int tag,
int index)
Returns the value of a particular index of a given tag as a
double.
|
float |
getFieldAsFloat(int tag)
Returns the value of index 0 of a given tag as a float.
|
float |
getFieldAsFloat(int tag,
int index)
Returns the value of a particular index of a given tag as a
float.
|
long |
getFieldAsLong(int tag)
Returns the value of index 0 of a given tag as a
long.
|
long |
getFieldAsLong(int tag,
int index)
Returns the value of a particular index of a given tag as a
long.
|
XTIFFField[] |
getFields()
Returns an array of XTIFFFields containing all the fields
in this directory.
|
int |
getImageType()
Get the JAI Image decoded type.
|
static int |
getNumDirectories(com.sun.media.jai.codec.SeekableStream stream)
Returns the number of image directories (subimages) stored in a
given TIFF file, represented by a
SeekableStream . |
int |
getNumEntries()
Returns the number of directory entries.
|
int[] |
getTags()
Returns an ordered array of ints indicating the tag
values.
|
static XTIFFTileCodec |
getTileCodec(int comp)
Return the currently registered XTIFFTileCodec
for this compression type.
|
protected void |
initialize()
Initialize the directory from a stream
|
boolean |
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)
|
boolean |
isTagPresent(int tag)
Returns true if a tag appears in the directory.
|
boolean |
isTiled()
If true this image uses TIFF 6.0 tiling
|
protected double |
readDouble(com.sun.media.jai.codec.SeekableStream stream) |
java.lang.Object |
readFieldValue(int tag,
int type,
int count)
TIFF field-value reader.
|
protected float |
readFloat(com.sun.media.jai.codec.SeekableStream stream) |
protected void |
readHeader()
reads the TIFF header.
|
protected int |
readInt(com.sun.media.jai.codec.SeekableStream stream) |
protected long |
readLong(com.sun.media.jai.codec.SeekableStream stream) |
protected short |
readShort(com.sun.media.jai.codec.SeekableStream stream) |
protected long |
readUnsignedInt(com.sun.media.jai.codec.SeekableStream stream) |
protected int |
readUnsignedShort(com.sun.media.jai.codec.SeekableStream stream) |
static void |
registerTileCodec(int comp,
XTIFFTileCodec codec)
Register a new XTIFFTileCodec for encoding and decoding
compressed TIFF image data.
|
void |
setCompression(int compression)
Specifies the type of compression to be used.
|
static void |
setFactory(XTIFFFactory fact)
Set the XTIFFFactory, which is used to
construct the XTIFFDirectory object assigned as a
"tiff.directory" property in the resulting jai image.
|
void |
setImageType(int image_type)
Set the JAI Image decoded type.
|
void |
setIsTiled(boolean isTiled)
If set, the data will be written out in tiled format, instead of
in strips.
|
int |
sizeOfType(int type)
Return the size of a data type.
|
static void |
unRegisterTileCodec(int comp)
UnRegister the XTIFFTileCodec corresponding to the
TIFF compression type.
|
protected static XTIFFFactory factory
protected static java.util.Hashtable tileCodecs
protected transient com.sun.media.jai.codec.SeekableStream stream
public XTIFFDirectory()
protected XTIFFDirectory(com.sun.media.jai.codec.SeekableStream stream, int directory) throws java.io.IOException
stream
- a SeekableStream to read from.directory
- the index of the directory to read.java.io.IOException
protected XTIFFDirectory(com.sun.media.jai.codec.SeekableStream stream, long ifd_offset) throws java.io.IOException
stream
- a SeekableStream to read from.ifd_offset
- the long byte offset of the directory.java.io.IOException
public boolean isTiled()
protected void readHeader() throws java.io.IOException
java.io.IOException
public int sizeOfType(int type) throws java.lang.ArrayIndexOutOfBoundsException
type
- the XTIFFField type codejava.lang.ArrayIndexOutOfBoundsException
XTIFFField
,
XTIFFFactory
public void addField(int tag, int type, int count, java.lang.Object obj)
tag
- the TIFF tag listed in XTIFFtype
- the TIFF field type listed in XTIFFFieldcount
- the number of values in array objobj
- the array of valuesXTIFFField
,
XTIFF
public static XTIFFField createField(int tag, int type, int count, java.lang.Object obj)
tag
- the TIFF tag listed in XTIFFtype
- the TIFF field type listed in XTIFFFieldcount
- the number of values in array objobj
- the array of valuesXTIFFField
,
XTIFF
public void addField(XTIFFField field)
field
- the XTIFFField type codeXTIFFField
protected void initialize() throws java.io.IOException
java.io.IOException
public int getNumEntries()
public XTIFFField getField(int tag)
public boolean isTagPresent(int tag)
public int[] getTags()
public XTIFFField[] getFields()
public byte getFieldAsByte(int tag, int index)
public byte getFieldAsByte(int tag)
public long getFieldAsLong(int tag, int index)
public long getFieldAsLong(int tag)
public float getFieldAsFloat(int tag, int index)
public float getFieldAsFloat(int tag)
public double getFieldAsDouble(int tag, int index)
public double getFieldAsDouble(int tag)
public java.lang.Object readFieldValue(int tag, int type, int count) throws java.io.IOException, java.lang.ArrayIndexOutOfBoundsException
java.io.IOException
java.lang.ArrayIndexOutOfBoundsException
protected short readShort(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected int readUnsignedShort(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected int readInt(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected long readUnsignedInt(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected long readLong(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected float readFloat(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
protected double readDouble(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
java.io.IOException
public static int getNumDirectories(com.sun.media.jai.codec.SeekableStream stream) throws java.io.IOException
SeekableStream
.java.io.IOException
public boolean isBigEndian()
public void setCompression(int compression)
compression
- The compression type.public int getCompression()
public void setIsTiled(boolean isTiled)
isTiled
- Specifies whether the image data should be
wriiten out in tiled format.public XTIFFTileCodec createTileCodec(XTIFFDecodeParam param) throws java.io.IOException
param
- the encoding paramjava.io.IOException
XTIFFTileCodec
public XTIFFTileCodec createTileCodec(XTIFFEncodeParam param) throws java.io.IOException
param
- the encoding paramjava.io.IOException
XTIFFTileCodec
public static void setFactory(XTIFFFactory fact)
fact
- the factory to register. The factory is
guaranteed to always be non-null; if a null is passed
in then the default XTIFFFactory is used.
a null object is passed inXTIFFFactory
public static XTIFFDirectory create(com.sun.media.jai.codec.SeekableStream stream, int directory) throws java.io.IOException
stream
- a SeekableStream to read from.directory
- the index of the directory to read.java.io.IOException
XTIFFFactory
public static XTIFFDirectory create(com.sun.media.jai.codec.SeekableStream stream, long ifd_offset) throws java.io.IOException
stream
- a SeekableStream to read from.ifd_offset
- the long byte offset of the directory.java.io.IOException
XTIFFFactory
public static XTIFFDirectory create()
XTIFFFactory
public static XTIFFTileCodec getTileCodec(int comp)
XTIFFTileCodec
public static void unRegisterTileCodec(int comp)
comp
- The TIFF compression code indicatedpublic static void registerTileCodec(int comp, XTIFFTileCodec codec)
comp
- The TIFF compression code indicated by thecodec
- The codec to register.
XTIFF.TIFFTAG_COMPRESSION field.XTIFFTileCodec
public int getImageType()
public void setImageType(int image_type)
XTIFF
,
XTIFFImage
,
XTIFFTileCodec