01: /*
02: * GeoTIFF extension to JAI.
03: *
04: * Software distributed distributed on an "AS IS"
05: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
06: * Permission granted to use and modify this code,
07: * so long as this copyright notice appears in the derived code.
08: *
09: * Portions created by: Niles Ritter
10: * are Copyright (C): Niles Ritter, GeoTIFF.org, 1999,2000.
11: * All Rights Reserved.
12: * Contributor(s): Niles Ritter
13: */
14:
15: package org.geotiff.image.jai;
16:
17: import java.io.IOException;
18: import java.util.Enumeration;
19: import java.util.Hashtable;
20: import java.util.Vector;
21: import java.util.TreeMap;
22: import java.util.Iterator;
23:
24: import org.libtiff.jai.codec.XTIFFFactory;
25: import org.libtiff.jai.codec.XTIFFDirectory;
26:
27: // Warning: media libraries subject to change
28: import com.sun.media.jai.codec.SeekableStream;
29:
30: /**
31: * A factory object for a GeoTIFFDirectory and its corresponding
32: * XTIFFField class.
33: *
34: * @see XTIFFDirectory
35: * @see XTIFFField
36: */
37: public class GeoTIFFFactory extends XTIFFFactory implements
38: java.io.Serializable {
39: /**
40: * Default constructor
41: */
42: public GeoTIFFFactory() {
43: }
44:
45: /**
46: * Constructs a TIFFDirectoryFactory from a SeekableStream.
47: * The directory parameter specifies which directory to read from
48: * the linked list present in the stream; directory 0 is normally
49: * read but it is possible to store multiple images in a single
50: * TIFF file by maintaing multiple directories.
51: *
52: * @param stream a SeekableStream to read from.
53: * @param directory the index of the directory to read.
54: */
55: public XTIFFDirectory createDirectory(SeekableStream stream,
56: int directory) throws IOException {
57: return new GeoTIFFDirectory(stream, directory);
58: }
59:
60: /**
61: * Constructs a TIFFDirectory by reading a SeekableStream.
62: * The ifd_offset parameter specifies the stream offset from which
63: * to begin reading; this mechanism is sometimes used to store
64: * private IFDs within a TIFF file that are not part of the normal
65: * sequence of IFDs.
66: *
67: * @param stream a SeekableStream to read from.
68: * @param ifd_offset the long byte offset of the directory.
69: */
70: public XTIFFDirectory createDirectory(SeekableStream stream,
71: long ifd_offset) throws IOException {
72: return new GeoTIFFDirectory(stream, ifd_offset);
73: }
74:
75: /**
76: * Constructs an empty TIFFDirectory for writing
77: */
78: public XTIFFDirectory createDirectory() {
79: return new GeoTIFFDirectory();
80: }
81: }
|