001: package org.libtiff.jai.codec;
002:
003: /*
004: * XTIFF: eXtensible TIFF libraries for JAI.
005: *
006: * The contents of this file are subject to the JAVA ADVANCED IMAGING
007: * SAMPLE INPUT-OUTPUT CODECS AND WIDGET HANDLING SOURCE CODE License
008: * Version 1.0 (the "License"); You may not use this file except in
009: * compliance with the License. You may obtain a copy of the License at
010: * http://www.sun.com/software/imaging/JAI/index.html
011: *
012: * Software distributed under the License is distributed on an "AS IS"
013: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
014: * the License for the specific language governing rights and limitations
015: * under the License.
016: *
017: * The Original Code is JAVA ADVANCED IMAGING SAMPLE INPUT-OUTPUT CODECS
018: * AND WIDGET HANDLING SOURCE CODE.
019: * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
020: * Portions created by: Niles Ritter
021: * are Copyright (C): Niles Ritter, GeoTIFF.org, 1999,2000.
022: * All Rights Reserved.
023: * Contributor(s): Niles Ritter
024: */
025:
026: import java.io.IOException;
027: import java.util.Enumeration;
028: import java.util.Hashtable;
029: import java.util.Vector;
030: import java.util.TreeMap;
031: import java.util.Iterator;
032:
033: // Warning: media libraries subject to change
034: import com.sun.media.jai.codec.SeekableStream;
035:
036: /**
037: * A class representing the factory for constructing a XTIFFDirectory,
038: * and the corresponding XTIFFFields. If you are creating extensions
039: * to those classes, extend this class as well. See the GeoTIFF package
040: * for an example of how to do this.
041: *
042: * @see org.libtiff.jai.TIFFDescriptor
043: * @see XTIFFField
044: * @see XTIFFDirectory
045: */
046: public class XTIFFFactory extends Object implements
047: java.io.Serializable {
048: /**
049: * Default constructor
050: */
051: public XTIFFFactory() {
052: }
053:
054: /**
055: * Constructs an XTIFFDirectoryFactory from a SeekableStream.
056: * The directory parameter specifies which directory to read from
057: * the linked list present in the stream; directory 0 is normally
058: * read but it is possible to store multiple images in a single
059: * TIFF file by maintaing multiple directories.
060: *
061: * @param stream a SeekableStream to read from.
062: * @param directory the index of the directory to read.
063: */
064: public XTIFFDirectory createDirectory(SeekableStream stream,
065: int directory) throws IOException {
066: return new XTIFFDirectory(stream, directory);
067: }
068:
069: /**
070: * Constructs a XTIFFDirectory by reading a SeekableStream.
071: * The ifd_offset parameter specifies the stream offset from which
072: * to begin reading; this mechanism is sometimes used to store
073: * private IFDs within a TIFF file that are not part of the normal
074: * sequence of IFDs.
075: *
076: * @param stream a SeekableStream to read from.
077: * @param ifd_offset the long byte offset of the directory.
078: */
079: public XTIFFDirectory createDirectory(SeekableStream stream,
080: long ifd_offset) throws IOException {
081: return new XTIFFDirectory(stream, ifd_offset);
082: }
083:
084: /**
085: * Constructs an empty XTIFFDirectory for encoding
086: */
087: public XTIFFDirectory createDirectory() {
088: return new XTIFFDirectory();
089: }
090:
091: /**
092: * Constructs an XTIFFField from values
093: * @param tag the TIFF tag listed in XTIFF
094: * @param type the TIFF field type listed in XTIFFField
095: * @param count the number of values in array obj
096: * @param obj the array of values
097: * @see XTIFFField
098: */
099: public XTIFFField createField(int tag, int type, int count,
100: Object obj) {
101: return new XTIFFField(tag, type, count, obj);
102: }
103: }
|