Source Code Cross Referenced for SectionIDMap.java in  » Collaboration » poi-3.0.2-beta2 » org » apache » poi » hpsf » wellknown » 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 » Collaboration » poi 3.0.2 beta2 » org.apache.poi.hpsf.wellknown 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* ====================================================================
002:           Licensed to the Apache Software Foundation (ASF) under one or more
003:           contributor license agreements.  See the NOTICE file distributed with
004:           this work for additional information regarding copyright ownership.
005:           The ASF licenses this file to You under the Apache License, Version 2.0
006:           (the "License"); you may not use this file except in compliance with
007:           the License.  You may obtain a copy of the License at
008:
009:               http://www.apache.org/licenses/LICENSE-2.0
010:
011:           Unless required by applicable law or agreed to in writing, software
012:           distributed under the License is distributed on an "AS IS" BASIS,
013:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:           See the License for the specific language governing permissions and
015:           limitations under the License.
016:        ==================================================================== */
017:
018:        package org.apache.poi.hpsf.wellknown;
019:
020:        import java.util.HashMap;
021:
022:        /**
023:         * <p>Maps section format IDs to {@link PropertyIDMap}s. It is
024:         * initialized with two well-known section format IDs: those of the
025:         * <tt>\005SummaryInformation</tt> stream and the
026:         * <tt>\005DocumentSummaryInformation</tt> stream.</p>
027:         *
028:         * <p>If you have a section format ID you can use it as a key to query
029:         * this map.  If you get a {@link PropertyIDMap} returned your section
030:         * is well-known and you can query the {@link PropertyIDMap} for PID
031:         * strings. If you get back <code>null</code> you are on your own.</p>
032:         *
033:         * <p>This {@link java.util.Map} expects the byte arrays of section format IDs
034:         * as keys. A key maps to a {@link PropertyIDMap} describing the
035:         * property IDs in sections with the specified section format ID.</p>
036:         *
037:         * @author Rainer Klute (klute@rainer-klute.de)
038:         * @version $Id: SectionIDMap.java 489730 2006-12-22 19:18:16Z bayard $
039:         * @since 2002-02-09
040:         */
041:        public class SectionIDMap extends HashMap {
042:
043:            /**
044:             * <p>The SummaryInformation's section's format ID.</p>
045:             */
046:            public static final byte[] SUMMARY_INFORMATION_ID = new byte[] {
047:                    (byte) 0xF2, (byte) 0x9F, (byte) 0x85, (byte) 0xE0,
048:                    (byte) 0x4F, (byte) 0xF9, (byte) 0x10, (byte) 0x68,
049:                    (byte) 0xAB, (byte) 0x91, (byte) 0x08, (byte) 0x00,
050:                    (byte) 0x2B, (byte) 0x27, (byte) 0xB3, (byte) 0xD9 };
051:
052:            /**
053:             * <p>The DocumentSummaryInformation's first and second sections' format
054:             * ID.</p>
055:             */
056:            public static final byte[][] DOCUMENT_SUMMARY_INFORMATION_ID = new byte[][] {
057:                    { (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x02,
058:                            (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B,
059:                            (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00,
060:                            (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE },
061:                    { (byte) 0xD5, (byte) 0xCD, (byte) 0xD5, (byte) 0x05,
062:                            (byte) 0x2E, (byte) 0x9C, (byte) 0x10, (byte) 0x1B,
063:                            (byte) 0x93, (byte) 0x97, (byte) 0x08, (byte) 0x00,
064:                            (byte) 0x2B, (byte) 0x2C, (byte) 0xF9, (byte) 0xAE } };
065:
066:            /**
067:             * <p>A property without a known name is described by this string.</p> 
068:             */
069:            public static final String UNDEFINED = "[undefined]";
070:
071:            /**
072:             * <p>The default section ID map. It maps section format IDs to
073:             * {@link PropertyIDMap}s.</p>
074:             */
075:            private static SectionIDMap defaultMap;
076:
077:            /**
078:             * <p>Returns the singleton instance of the default {@link
079:             * SectionIDMap}.</p>
080:             *
081:             * @return The instance value
082:             */
083:            public static SectionIDMap getInstance() {
084:                if (defaultMap == null) {
085:                    final SectionIDMap m = new SectionIDMap();
086:                    m.put(SUMMARY_INFORMATION_ID, PropertyIDMap
087:                            .getSummaryInformationProperties());
088:                    m.put(DOCUMENT_SUMMARY_INFORMATION_ID[0], PropertyIDMap
089:                            .getDocumentSummaryInformationProperties());
090:                    defaultMap = m;
091:                }
092:                return defaultMap;
093:            }
094:
095:            /**
096:             * <p>Returns the property ID string that is associated with a
097:             * given property ID in a section format ID's namespace.</p>
098:             *
099:             * @param sectionFormatID Each section format ID has its own name
100:             * space of property ID strings and thus must be specified.
101:             * @param  pid The property ID
102:             * @return The well-known property ID string associated with the
103:             * property ID <var>pid</var> in the name space spanned by <var>
104:             * sectionFormatID</var> . If the <var>pid</var>
105:             * /<var>sectionFormatID </var> combination is not well-known, the
106:             * string "[undefined]" is returned.
107:             */
108:            public static String getPIDString(final byte[] sectionFormatID,
109:                    final long pid) {
110:                final PropertyIDMap m = getInstance().get(sectionFormatID);
111:                if (m == null)
112:                    return UNDEFINED;
113:                else {
114:                    final String s = (String) m.get(pid);
115:                    if (s == null)
116:                        return UNDEFINED;
117:                    return s;
118:                }
119:            }
120:
121:            /**
122:             * <p>Returns the {@link PropertyIDMap} for a given section format
123:             * ID.</p>
124:             * 
125:             * @param sectionFormatID the section format ID
126:             * @return the property ID map
127:             */
128:            public PropertyIDMap get(final byte[] sectionFormatID) {
129:                return (PropertyIDMap) super .get(new String(sectionFormatID));
130:            }
131:
132:            /**
133:             * <p>Returns the {@link PropertyIDMap} for a given section format
134:             * ID.</p>
135:             *
136:             * @param sectionFormatID A section format ID as a <tt>byte[]</tt> .
137:             * @deprecated Use {@link #get(byte[])} instead!
138:             * @return the property ID map
139:             */
140:            public Object get(final Object sectionFormatID) {
141:                return get((byte[]) sectionFormatID);
142:            }
143:
144:            /**
145:             * <p>Associates a section format ID with a {@link
146:             * PropertyIDMap}.</p>
147:             * 
148:             * @param sectionFormatID the section format ID
149:             * @param propertyIDMap the property ID map
150:             * @return as defined by {@link java.util.Map#put}
151:             */
152:            public Object put(final byte[] sectionFormatID,
153:                    final PropertyIDMap propertyIDMap) {
154:                return super .put(new String(sectionFormatID), propertyIDMap);
155:            }
156:
157:            /**
158:             * @deprecated Use {@link #put(byte[], PropertyIDMap)} instead!
159:             *
160:             * @see #put(byte[], PropertyIDMap)
161:             * 
162:             * @param key This parameter remains undocumented since the method is
163:             * deprecated.
164:             * @param value This parameter remains undocumented since the method is
165:             * deprecated.
166:             * @return The return value remains undocumented since the method is
167:             * deprecated.
168:             */
169:            public Object put(final Object key, final Object value) {
170:                return put((byte[]) key, (PropertyIDMap) value);
171:            }
172:
173:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.