Source Code Cross Referenced for PropertySet.java in  » 6.0-JDK-Modules » Java-Advanced-Imaging » com » sun » media » jai » codecimpl » fpx » 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.codecimpl.fpx 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: PropertySet.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:41 $
010:         * $State: Exp $
011:         */
012:        package com.sun.media.jai.codecimpl.fpx;
013:
014:        import java.awt.RenderingHints;
015:        import java.io.IOException;
016:        import java.util.Date;
017:        import java.util.Hashtable;
018:        import com.sun.media.jai.codec.SeekableStream;
019:        import com.sun.media.jai.codecimpl.ImagingListenerProxy;
020:        import com.sun.media.jai.codecimpl.util.ImagingException;
021:
022:        class Property {
023:
024:            private int type;
025:            private int offset;
026:
027:            public Property(int type, int offset) {
028:                this .type = type;
029:                this .offset = offset;
030:            }
031:
032:            public int getType() {
033:                return type;
034:            }
035:
036:            public int getOffset() {
037:                return offset;
038:            }
039:        }
040:
041:        class PropertySet {
042:
043:            private static final int TYPE_VT_EMPTY = -1;
044:            private static final int TYPE_VT_NULL = -1;
045:            private static final int TYPE_VT_I2 = 2;
046:            private static final int TYPE_VT_I4 = 3;
047:            private static final int TYPE_VT_R4 = -1;
048:            private static final int TYPE_VT_R8 = -1;
049:            private static final int TYPE_VT_CY = -1;
050:            private static final int TYPE_VT_DATE = -1;
051:            private static final int TYPE_VT_BSTR = -1;
052:            private static final int TYPE_VT_ERROR = -1;
053:            private static final int TYPE_VT_BOOL = -1;
054:            private static final int TYPE_VT_VARIANT = -1;
055:            private static final int TYPE_VT_UI1 = -1;
056:            private static final int TYPE_VT_UI2 = -1;
057:            private static final int TYPE_VT_UI4 = 19;
058:            private static final int TYPE_VT_I8 = -1;
059:            private static final int TYPE_VT_UI8 = -1;
060:            private static final int TYPE_VT_LPSTR = 30;
061:            private static final int TYPE_VT_LPWSTR = 31;
062:            private static final int TYPE_VT_FILETIME = 64;
063:            private static final int TYPE_VT_BLOB = 65;
064:            private static final int TYPE_VT_STREAM = -1;
065:            private static final int TYPE_VT_STORAGE = -1;
066:            private static final int TYPE_VT_STREAMED_OBJECT = -1;
067:            private static final int TYPE_VT_STORED_OBJECT = -1;
068:            private static final int TYPE_VT_BLOB_OBJECT = -1;
069:            private static final int TYPE_VT_CF = 71;
070:            private static final int TYPE_VT_CLSID = 72;
071:            private static final int TYPE_VT_VECTOR = 4096;
072:
073:            SeekableStream stream;
074:            Hashtable properties = new Hashtable();
075:
076:            public PropertySet(SeekableStream stream) throws IOException {
077:                this .stream = stream;
078:
079:                stream.seek(44);
080:                int sectionOffset = stream.readIntLE();
081:
082:                stream.seek(sectionOffset);
083:                int sectionSize = stream.readIntLE();
084:                int sectionCount = stream.readIntLE();
085:
086:                for (int i = 0; i < sectionCount; i++) {
087:                    stream.seek(sectionOffset + 8 * i + 8);
088:                    int pid = stream.readIntLE();
089:                    int offset = stream.readIntLE();
090:
091:                    stream.seek(sectionOffset + offset);
092:                    int type = stream.readIntLE();
093:
094:                    Property p = new Property(type, sectionOffset + offset + 4);
095:                    properties.put(new Integer(pid), p);
096:                }
097:            }
098:
099:            public boolean hasProperty(int id) {
100:                Property p = (Property) properties.get(new Integer(id));
101:                return (p != null);
102:            }
103:
104:            public int getI4(int id) {
105:                Property p = (Property) properties.get(new Integer(id));
106:                try {
107:                    int offset = p.getOffset();
108:                    stream.seek(offset);
109:                    return stream.readIntLE();
110:                } catch (IOException e) {
111:                    ImagingListenerProxy.errorOccurred(JaiI18N
112:                            .getString("PropertySet1"), e, this , false);
113:                    //            e.printStackTrace();
114:                }
115:
116:                return -1;
117:            }
118:
119:            public int getUI1(int id) {
120:                Property p = (Property) properties.get(new Integer(id));
121:                try {
122:                    int offset = p.getOffset();
123:                    stream.seek(offset);
124:                    return stream.readUnsignedByte();
125:                } catch (IOException e) {
126:                    ImagingListenerProxy.errorOccurred(JaiI18N
127:                            .getString("PropertySet1"), e, this , false);
128:                    //            e.printStackTrace();
129:                }
130:
131:                return -1;
132:            }
133:
134:            public int getUI2(int id) {
135:                Property p = (Property) properties.get(new Integer(id));
136:                try {
137:                    int offset = p.getOffset();
138:                    stream.seek(offset);
139:                    return stream.readUnsignedShortLE();
140:                } catch (IOException e) {
141:                    ImagingListenerProxy.errorOccurred(JaiI18N
142:                            .getString("PropertySet2"), e, this , false);
143:                    //            e.printStackTrace();
144:                }
145:
146:                return -1;
147:            }
148:
149:            public long getUI4(int id) {
150:                Property p = (Property) properties.get(new Integer(id));
151:                try {
152:                    int offset = p.getOffset();
153:                    stream.seek(offset);
154:                    return stream.readUnsignedIntLE();
155:                } catch (IOException e) {
156:                    ImagingListenerProxy.errorOccurred(JaiI18N
157:                            .getString("PropertySet4"), e, this , false);
158:                    //            e.printStackTrace();
159:                }
160:
161:                return -1;
162:            }
163:
164:            public long getUI4(int id, long defaultValue) {
165:                Property p = (Property) properties.get(new Integer(id));
166:                if (p == null) {
167:                    return defaultValue;
168:                }
169:
170:                try {
171:                    int offset = p.getOffset();
172:                    stream.seek(offset);
173:                    return stream.readUnsignedIntLE();
174:                } catch (IOException e) {
175:                    ImagingListenerProxy.errorOccurred(JaiI18N
176:                            .getString("PropertySet4"), e, this , false);
177:                    //            e.printStackTrace();
178:                }
179:
180:                return -1;
181:            }
182:
183:            public String getLPSTR(int id) {
184:                Property p = (Property) properties.get(new Integer(id));
185:                if (p == null) {
186:                    return null;
187:                }
188:
189:                try {
190:                    int offset = p.getOffset();
191:
192:                    stream.seek(offset);
193:                    int length = stream.readIntLE();
194:                    StringBuffer sb = new StringBuffer(length);
195:                    for (int i = 0; i < length; i++) {
196:                        sb.append((char) stream.read());
197:                    }
198:
199:                    return sb.toString();
200:                } catch (IOException e) {
201:                    ImagingListenerProxy.errorOccurred(JaiI18N
202:                            .getString("PropertySet5"), e, this , false);
203:                    //            e.printStackTrace();
204:                    return null;
205:                }
206:            }
207:
208:            public String getLPWSTR(int id) {
209:                Property p = (Property) properties.get(new Integer(id));
210:                try {
211:                    int offset = p.getOffset();
212:
213:                    stream.seek(offset);
214:                    int length = stream.readIntLE();
215:                    StringBuffer sb = new StringBuffer(length);
216:                    for (int i = 0; i < length; i++) {
217:                        sb.append(stream.readCharLE());
218:                    }
219:
220:                    return sb.toString();
221:                } catch (IOException e) {
222:                    ImagingListenerProxy.errorOccurred(JaiI18N
223:                            .getString("PropertySet5"), e, this , false);
224:                    //            e.printStackTrace();
225:                    return null;
226:                }
227:            }
228:
229:            public float getR4(int id) {
230:                Property p = (Property) properties.get(new Integer(id));
231:                try {
232:                    int offset = p.getOffset();
233:                    stream.seek(offset);
234:                    return stream.readFloatLE();
235:                } catch (IOException e) {
236:                    ImagingListenerProxy.errorOccurred(JaiI18N
237:                            .getString("PropertySet6"), e, this , false);
238:                    //            e.printStackTrace();
239:                    return -1.0F;
240:                }
241:            }
242:
243:            public Date getDate(int id) {
244:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
245:            }
246:
247:            public Date getFiletime(int id) {
248:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
249:            }
250:
251:            public byte[] getBlob(int id) {
252:                Property p = (Property) properties.get(new Integer(id));
253:                try {
254:                    int offset = p.getOffset();
255:                    stream.seek(offset);
256:                    int length = stream.readIntLE();
257:
258:                    byte[] buf = new byte[length];
259:                    stream.seek(offset + 4);
260:                    stream.readFully(buf);
261:
262:                    return buf;
263:                } catch (IOException e) {
264:                    ImagingListenerProxy.errorOccurred(JaiI18N
265:                            .getString("PropertySet7"), e, this , false);
266:                    //            e.printStackTrace();
267:                    return null;
268:                }
269:            }
270:
271:            public int[] getUI1Vector(int id) {
272:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
273:            }
274:
275:            public int[] getUI2Vector(int id) {
276:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
277:            }
278:
279:            public long[] getUI4Vector(int id) {
280:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
281:            }
282:
283:            public float[] getR4Vector(int id) {
284:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
285:            }
286:
287:            public String[] getLPWSTRVector(int id) {
288:                throw new RuntimeException(JaiI18N.getString("PropertySet0"));
289:            }
290:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.