117 TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
118 ? null
119 : TimeZone.getDefault();
120
121 try {
122 Utils.currentInstance.set(this);
123 if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
124 final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
125 BufferedInputStream in0 = new BufferedInputStream(in);
126 if (Utils.isJarMagic(Utils.readMagic(in0))) {
127 if (verbose > 0)
128 Utils.log.info("Copying unpacked JAR file...");
129 Utils.copyJarFile(new JarInputStream(in0), out);
130 } else if (props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
131 (new DoUnpack()).run(in0, out);
132 in0.close();
133 Utils.markJarFile(out);
134 } else {
135 try {
136 (new NativeUnpack(this)).run(in0, out);
137 in0.close();
138 Utils.markJarFile(out);
139 } catch (UnsatisfiedLinkError ule) {
140 // failover to java implementation
141 (new DoUnpack()).run(in0, out);
142 in0.close();
143 Utils.markJarFile(out);
144 }
145 }
146 } finally {
147 _nunp = null;
148 Utils.currentInstance.set(null);
149 if (tz != null) TimeZone.setDefault(tz);
150 }
151 }
152
153 /**
154 * Takes an input File containing the pack file, and generates a JarOutputStream.
155 * <p>
156 * Does not close its output. (The output can accumulate more elements.)
157 * @param in a File.
158 * @param out a JarOutputStream.
159 * @exception IOException if an error is encountered.
160 */
161 public synchronized void unpack(File in, JarOutputStream out) throws IOException {
162 if (in == null) {
163 throw new NullPointerException("null input");
164 }
165 if (out == null) {
|
117 TimeZone tz = (props.getBoolean(Utils.PACK_DEFAULT_TIMEZONE))
118 ? null
119 : TimeZone.getDefault();
120
121 try {
122 Utils.currentInstance.set(this);
123 if (tz != null) TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
124 final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
125 BufferedInputStream in0 = new BufferedInputStream(in);
126 if (Utils.isJarMagic(Utils.readMagic(in0))) {
127 if (verbose > 0)
128 Utils.log.info("Copying unpacked JAR file...");
129 Utils.copyJarFile(new JarInputStream(in0), out);
130 } else if (props.getBoolean(Utils.DEBUG_DISABLE_NATIVE)) {
131 (new DoUnpack()).run(in0, out);
132 in0.close();
133 Utils.markJarFile(out);
134 } else {
135 try {
136 (new NativeUnpack(this)).run(in0, out);
137 } catch (UnsatisfiedLinkError ule) {
138 // failover to java implementation
139 (new DoUnpack()).run(in0, out);
140 }
141 in0.close();
142 Utils.markJarFile(out);
143 }
144 } finally {
145 _nunp = null;
146 Utils.currentInstance.set(null);
147 if (tz != null) TimeZone.setDefault(tz);
148 }
149 }
150
151 /**
152 * Takes an input File containing the pack file, and generates a JarOutputStream.
153 * <p>
154 * Does not close its output. (The output can accumulate more elements.)
155 * @param in a File.
156 * @param out a JarOutputStream.
157 * @exception IOException if an error is encountered.
158 */
159 public synchronized void unpack(File in, JarOutputStream out) throws IOException {
160 if (in == null) {
161 throw new NullPointerException("null input");
162 }
163 if (out == null) {
|