Source Code Cross Referenced for ImageDecoderImpl.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » com » sun » media » jai » codec » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » Java Advanced Imaging » com.sun.media.jai.codec 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: ImageDecoderImpl.java,v $
003:         *
004:         * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * Use is subject to license terms.
007:         *
008:         * $Revision: 1.1 $
009:         * $Date: 2005/02/11 04:55:30 $
010:         * $State: Exp $
011:         */
012:        package com.sun.media.jai.codec;
013:
014:        import java.awt.image.Raster;
015:        import java.awt.image.RenderedImage;
016:        import java.io.InputStream;
017:        import java.io.IOException;
018:
019:        /**
020:         * A partial implementation of the <code>ImageDecoder</code> interface
021:         * useful for subclassing.
022:         *
023:         * <p><b> This class is not a committed part of the JAI API.  It may
024:         * be removed or changed in future releases of JAI.</b>
025:         */
026:        public abstract class ImageDecoderImpl implements  ImageDecoder {
027:
028:            /**
029:             * The <code>SeekableStream</code> associcted with this
030:             * <code>ImageEncoder</code>.
031:             */
032:            protected SeekableStream input;
033:
034:            /**
035:             * The <code>ImageDecodeParam</code> object associated with this
036:             * <code>ImageEncoder</code>.
037:             */
038:            protected ImageDecodeParam param;
039:
040:            /**
041:             * Constructs an <code>ImageDecoderImpl</code> with a given
042:             * <code>SeekableStream</code> and <code>ImageDecodeParam</code>
043:             * instance.
044:             */
045:            public ImageDecoderImpl(SeekableStream input, ImageDecodeParam param) {
046:                this .input = input;
047:                this .param = param;
048:            }
049:
050:            /**
051:             * Constructs an <code>ImageDecoderImpl</code> with a given
052:             * <code>InputStream</code> and <code>ImageDecodeParam</code>
053:             * instance.  The <code>input</code> parameter will be used to
054:             * construct a <code>ForwardSeekableStream</code>; if the ability
055:             * to seek backwards is required, the caller should construct
056:             * an instance of <code>SeekableStream</code> and
057:             * make use of the other contructor.
058:             */
059:            public ImageDecoderImpl(InputStream input, ImageDecodeParam param) {
060:                this .input = new ForwardSeekableStream(input);
061:                this .param = param;
062:            }
063:
064:            /**
065:             * Returns the current parameters as an instance of the
066:             * <code>ImageDecodeParam</code> interface.  Concrete
067:             * implementations of this interface will return corresponding
068:             * concrete implementations of the <code>ImageDecodeParam</code>
069:             * interface.  For example, a <code>JPEGImageDecoder</code> will
070:             * return an instance of <code>JPEGDecodeParam</code>.
071:             */
072:            public ImageDecodeParam getParam() {
073:                return param;
074:            }
075:
076:            /**
077:             * Sets the current parameters to an instance of the
078:             * <code>ImageDecodeParam</code> interface.  Concrete
079:             * implementations of <code>ImageDecoder</code> may throw a
080:             * <code>RuntimeException</code> if the <code>param</code>
081:             * argument is not an instance of the appropriate subclass or
082:             * subinterface.  For example, a <code>JPEGImageDecoder</code>
083:             * will expect <code>param</code> to be an instance of
084:             * <code>JPEGDecodeParam</code>.
085:             */
086:            public void setParam(ImageDecodeParam param) {
087:                this .param = param;
088:            }
089:
090:            /**
091:             * Returns the <code>SeekableStream</code> associated with
092:             * this <code>ImageDecoder</code>.
093:             */
094:            public SeekableStream getInputStream() {
095:                return input;
096:            }
097:
098:            /**
099:             * Returns the number of pages present in the current stream.
100:             * By default, the return value is 1.  Subclasses that deal with
101:             * multi-page formats should override this method.
102:             */
103:            public int getNumPages() throws IOException {
104:                return 1;
105:            }
106:
107:            /**
108:             * Returns a <code>Raster</code> that contains the decoded
109:             * contents of the <code>SeekableStream</code> associated
110:             * with this <code>ImageDecoder</code>.  Only
111:             * the first page of a multi-page image is decoded.
112:             */
113:            public Raster decodeAsRaster() throws IOException {
114:                return decodeAsRaster(0);
115:            }
116:
117:            /**
118:             * Returns a <code>Raster</code> that contains the decoded
119:             * contents of the <code>SeekableStream</code> associated
120:             * with this <code>ImageDecoder</code>.
121:             * The given page of a multi-page image is decoded.  If
122:             * the page does not exist, an IOException will be thrown.
123:             * Page numbering begins at zero.
124:             *
125:             * @param page The page to be decoded.
126:             */
127:            public Raster decodeAsRaster(int page) throws IOException {
128:                RenderedImage im = decodeAsRenderedImage(page);
129:                return im.getData();
130:            }
131:
132:            /**
133:             * Returns a <code>RenderedImage</code> that contains the decoded
134:             * contents of the <code>SeekableStream</code> associated
135:             * with this <code>ImageDecoder</code>.  Only
136:             * the first page of a multi-page image is decoded.
137:             */
138:            public RenderedImage decodeAsRenderedImage() throws IOException {
139:                return decodeAsRenderedImage(0);
140:            }
141:
142:            /**
143:             * Returns a <code>RenderedImage</code> that contains the decoded
144:             * contents of the <code>SeekableStream</code> associated
145:             * with this <code>ImageDecoder</code>.
146:             * The given page of a multi-page image is decoded.  If
147:             * the page does not exist, an IOException will be thrown.
148:             * Page numbering begins at zero.
149:             *
150:             * @param page The page to be decoded.
151:             */
152:            public abstract RenderedImage decodeAsRenderedImage(int page)
153:                    throws IOException;
154:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.