KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > ext > awt > image > spi > StreamRegistryEntry


1 /*
2
3    Copyright 2001 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.ext.awt.image.spi;
19
20 import java.io.InputStream JavaDoc;
21 import java.io.StreamCorruptedException JavaDoc;
22
23 import org.apache.batik.ext.awt.image.renderable.Filter;
24 import org.apache.batik.util.ParsedURL;
25
26 /**
27  * This type of Image tag registy entry is used for most normal image
28  * file formats. You are given a markable stream and an opportunity
29  * to check if it is "compatible" if you return true then you will
30  * likely be asked to provide the decoded image next.
31  * @see MagicNumberRegistryEntry
32  */

33 public interface StreamRegistryEntry extends RegistryEntry {
34
35     /**
36      * returns the number of bytes that need to be
37      * supported by mark on the InputStream for this
38      * to check the stream for compatibility.
39      */

40     public int getReadlimit();
41
42     /**
43      * Check if the Stream references an image that can be handled by
44      * this format handler. The input stream passed in should be
45      * assumed to support mark and reset.
46      *
47      * If this method throws a StreamCorruptedException then the
48      * InputStream will be closed and a new one opened (if possible).
49      *
50      * This method should only throw a StreamCorruptedException if it
51      * is unable to restore the state of the InputStream
52      * (i.e. mark/reset fails basically).
53      */

54     public boolean isCompatibleStream(InputStream JavaDoc is)
55         throws StreamCorruptedException JavaDoc;
56
57     /**
58      * Decode the Stream into a Filter. If the stream turns out not to
59      * be of a format this RegistryEntry can handle you should attempt
60      * to reset the stream, then return null.<P>
61      *
62      * This should only return a broken link image when the image is
63      * clearly of this format, but is unreadable for some reason.
64      *
65      * @param is The input stream that contains the image.
66      * @param origURL The original URL, if any, for documentation
67      * purposes only. This may be null.
68      * @param needRawData If true the image returned should not have
69      * any default color correction the file may
70      * specify applied.
71      */

72     public Filter handleStream(InputStream JavaDoc is,
73                                ParsedURL origURL,
74                                boolean needRawData);
75 }
76
77
Popular Tags