Source Code Cross Referenced for Pack200.java in  » Apache-Harmony-Java-SE » java-package » java » util » jar » 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 » Apache Harmony Java SE » java package » java.util.jar 
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:        package java.util.jar;
018:
019:        import java.beans.PropertyChangeListener;
020:        import java.io.File;
021:        import java.io.IOException;
022:        import java.io.InputStream;
023:        import java.io.OutputStream;
024:        import java.security.AccessController;
025:        import java.security.PrivilegedAction;
026:        import java.util.SortedMap;
027:
028:        /**
029:         * Class that initialize Packer and Unpacker
030:         * 
031:         * See JSR200
032:         */
033:        public abstract class Pack200 {
034:
035:            private static final String SYSTEM_PROPERTY_PACKER = "java.util.jar.Pack200.Packer"; //$NON-NLS-1$
036:
037:            private static final String SYSTEM_PROPERTY_UNPACKER = "java.util.jar.Pack200.Unpacker"; //$NON-NLS-1$
038:
039:            /**
040:             * Prevent this class from being instantiated.
041:             */
042:            private Pack200() {
043:                // do nothing
044:            }
045:
046:            /**
047:             * The method first read from system property for the classname of a Packer,
048:             * if such property exists, the class shall be initialized; or the default
049:             * Packer will be returned
050:             * 
051:             * @return a instance of Packer
052:             */
053:            public static Pack200.Packer newPacker() {
054:                return (Packer) AccessController
055:                        .doPrivileged(new PrivilegedAction<Object>() {
056:                            public Object run() {
057:                                String className = System
058:                                        .getProperty(SYSTEM_PROPERTY_PACKER,
059:                                                "org.apache.harmony.archive.internal.pack200.Pack200PackerAdapter"); //$NON-NLS-1$
060:                                try {
061:                                    // TODO Not sure if this will cause problems with
062:                                    // loading the packer
063:                                    return ClassLoader.getSystemClassLoader()
064:                                            .loadClass(className).newInstance();
065:                                } catch (Exception e) {
066:                                    throw new Error("Can't load class "
067:                                            + className, e);
068:                                }
069:                            }
070:                        });
071:
072:            }
073:
074:            /**
075:             * The method first read from system property for the classname of a
076:             * Unpacker, if such property exists, the class shall be initialized; or the
077:             * default Unpacker will be returned
078:             * 
079:             * @return a instance of Unpacker
080:             */
081:            public static Pack200.Unpacker newUnpacker() {
082:                return (Unpacker) AccessController
083:                        .doPrivileged(new PrivilegedAction<Object>() {
084:                            public Object run() {
085:                                String className = System
086:                                        .getProperty(SYSTEM_PROPERTY_UNPACKER,
087:                                                "org.apache.harmony.archive.internal.pack200.Pack200UnpackerAdapter");//$NON-NLS-1$
088:                                try {
089:                                    return ClassLoader.getSystemClassLoader()
090:                                            .loadClass(className).newInstance();
091:                                } catch (Exception e) {
092:                                    throw new Error("Can't load class "
093:                                            + className, e);
094:                                }
095:                            }
096:                        });
097:            }
098:
099:            /**
100:             * interface of Packer
101:             * 
102:             * See JSR 200 specification
103:             */
104:            public static interface Packer {
105:
106:                /**
107:                 * the format of a class attribute name
108:                 */
109:                static final String CLASS_ATTRIBUTE_PFX = "pack.class.attribute."; //$NON-NLS-1$
110:
111:                /**
112:                 * the format of a code attribute name
113:                 */
114:                static final String CODE_ATTRIBUTE_PFX = "pack.code.attribute."; //$NON-NLS-1$
115:
116:                /**
117:                 * the deflation hint to set in the output archive
118:                 */
119:                static final String DEFLATE_HINT = "pack.deflate.hint";//$NON-NLS-1$
120:
121:                /**
122:                 * the indicated amount of effort to use in compressing the archive.
123:                 */
124:                static final String EFFORT = "pack.effort";//$NON-NLS-1$
125:
126:                /**
127:                 * a String of error
128:                 */
129:                static final String ERROR = "error";//$NON-NLS-1$
130:
131:                /**
132:                 * a String of false
133:                 */
134:                static final String FALSE = "false";//$NON-NLS-1$
135:
136:                /**
137:                 * the format of a field attribute name
138:                 */
139:                static final String FIELD_ATTRIBUTE_PFX = "pack.field.attribute.";//$NON-NLS-1$
140:
141:                /**
142:                 * a String of keep
143:                 */
144:                static final String KEEP = "keep";//$NON-NLS-1$
145:
146:                /**
147:                 * decide if all elements shall transmit in their original order
148:                 */
149:                static final String KEEP_FILE_ORDER = "pack.keep.file.order";//$NON-NLS-1$
150:
151:                /**
152:                 * a String of latest
153:                 */
154:                static final String LATEST = "latest";//$NON-NLS-1$
155:
156:                /**
157:                 * the format of a method attribute name
158:                 */
159:                static final String METHOD_ATTRIBUTE_PFX = "pack.method.attribute.";//$NON-NLS-1$
160:
161:                /**
162:                 * Packer shall attempt to determine the latest modification time if
163:                 * this is set to LASTEST
164:                 */
165:                static final String MODIFICATION_TIME = "pack.modification.time";//$NON-NLS-1$
166:
167:                /**
168:                 * a String of pass
169:                 */
170:                static final String PASS = "pass";//$NON-NLS-1$
171:
172:                /**
173:                 * the file that will not be compressed.
174:                 */
175:                static final String PASS_FILE_PFX = "pack.pass.file.";//$NON-NLS-1$
176:
177:                /**
178:                 * packer progress as a percentage
179:                 */
180:                static final String PROGRESS = "pack.progress";//$NON-NLS-1$
181:
182:                /**
183:                 * The number of bytes of each archive segment.
184:                 */
185:                static final String SEGMENT_LIMIT = "pack.segment.limit";//$NON-NLS-1$
186:
187:                /**
188:                 * a String of strip
189:                 */
190:                static final String STRIP = "strip";//$NON-NLS-1$
191:
192:                /**
193:                 * a String of true
194:                 */
195:                static final String TRUE = "true";//$NON-NLS-1$
196:
197:                /**
198:                 * the action to take if an unknown attribute is encountered.
199:                 */
200:                static final String UNKNOWN_ATTRIBUTE = "pack.unknown.attribute";//$NON-NLS-1$
201:
202:                /**
203:                 * 
204:                 * @return the properties of packer
205:                 */
206:                SortedMap<String, String> properties();
207:
208:                /**
209:                 * Pack jarfile with pack arithmetic
210:                 * 
211:                 * @param in
212:                 *            jarfile to be compact
213:                 * @param out
214:                 *            stream of compact data
215:                 * @throws IOException
216:                 *             if I/O exception occurs
217:                 */
218:                void pack(JarFile in, OutputStream out) throws IOException;
219:
220:                /**
221:                 * Pack jarStream with pack arithmetic
222:                 * 
223:                 * @param in
224:                 *            stream of uncompact jar data
225:                 * @param out
226:                 *            stream of compact data
227:                 * @throws IOException
228:                 *             if I/O exception occurs
229:                 */
230:                void pack(JarInputStream in, OutputStream out)
231:                        throws IOException;
232:
233:                /**
234:                 * add a listener for PropertyChange events
235:                 * 
236:                 * @param listener
237:                 *            the listener to listen if PropertyChange events occurs
238:                 */
239:                void addPropertyChangeListener(PropertyChangeListener listener);
240:
241:                /**
242:                 * remove a listener
243:                 * 
244:                 * @param listener
245:                 *            listener to remove
246:                 */
247:                void removePropertyChangeListener(
248:                        PropertyChangeListener listener);
249:            }
250:
251:            /**
252:             * interface of unpacker
253:             * 
254:             * See JSR 200 specification
255:             */
256:            public static interface Unpacker {
257:
258:                /**
259:                 * The String indicating if the unpacker should ignore all transmitted
260:                 * values,can be replaced by either true or false
261:                 */
262:                static final String DEFLATE_HINT = "unpack.deflate.hint";//$NON-NLS-1$
263:
264:                /**
265:                 * a String of false
266:                 */
267:                static final String FALSE = "false";//$NON-NLS-1$
268:
269:                /**
270:                 * a String of keep
271:                 */
272:                static final String KEEP = "keep";//$NON-NLS-1$
273:
274:                /**
275:                 * the progress as a percentage
276:                 */
277:                static final String PROGRESS = "unpack.progress";//$NON-NLS-1$
278:
279:                /**
280:                 * a String of true
281:                 */
282:                static final String TRUE = "true";//$NON-NLS-1$
283:
284:                /**
285:                 * 
286:                 * @return the properties of unpacker
287:                 */
288:                SortedMap<String, String> properties();
289:
290:                /**
291:                 * unpack stream into jarfile with pack arithmetic
292:                 * 
293:                 * @param in
294:                 *            stream to uncompact
295:                 * @param out
296:                 *            jarstream of uncompact data
297:                 * @throws IOException
298:                 *             if I/O exception occurs
299:                 */
300:                void unpack(InputStream in, JarOutputStream out)
301:                        throws IOException;
302:
303:                /**
304:                 * unpack File into jarfile with pack arithmetic
305:                 * 
306:                 * @param in
307:                 *            file to be uncompact
308:                 * @param out
309:                 *            jarstream of uncompact data
310:                 * @throws IOException
311:                 *             if I/O exception occurs
312:                 */
313:                void unpack(File in, JarOutputStream out) throws IOException;
314:
315:                /**
316:                 * add a listener for PropertyChange events
317:                 * 
318:                 * @param listener
319:                 *            the listener to listen if PropertyChange events occurs
320:                 */
321:                void addPropertyChangeListener(PropertyChangeListener listener);
322:
323:                /**
324:                 * remove a listener
325:                 * 
326:                 * @param listener
327:                 *            listener to remove
328:                 */
329:                void removePropertyChangeListener(
330:                        PropertyChangeListener listener);
331:            }
332:
333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.