144 }
145 }
146
147 /**
148 * Takes an input File containing the pack file, and generates a JarOutputStream.
149 * <p>
150 * Does not close its output. (The output can accumulate more elements.)
151 * @param in a File.
152 * @param out a JarOutputStream.
153 * @exception IOException if an error is encountered.
154 */
155 public void unpack(File in, JarOutputStream out) throws IOException {
156 if (in == null) {
157 throw new NullPointerException("null input");
158 }
159 if (out == null) {
160 throw new NullPointerException("null output");
161 }
162 // Use the stream-based implementation.
163 // %%% Reconsider if native unpacker learns to memory-map the file.
164 FileInputStream instr = new FileInputStream(in);
165 unpack(instr, out);
166 if (props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
167 in.delete();
168 }
169 }
170
171 private class DoUnpack {
172 final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
173
174 {
175 props.setInteger(Pack200.Unpacker.PROGRESS, 0);
176 }
177
178 // Here's where the bits are read from disk:
179 final Package pkg = new Package();
180
181 final boolean keepModtime
182 = Pack200.Packer.KEEP.equals(
183 props.getProperty(Utils.UNPACK_MODIFICATION_TIME, Pack200.Packer.KEEP));
184 final boolean keepDeflateHint
185 = Pack200.Packer.KEEP.equals(
|
144 }
145 }
146
147 /**
148 * Takes an input File containing the pack file, and generates a JarOutputStream.
149 * <p>
150 * Does not close its output. (The output can accumulate more elements.)
151 * @param in a File.
152 * @param out a JarOutputStream.
153 * @exception IOException if an error is encountered.
154 */
155 public void unpack(File in, JarOutputStream out) throws IOException {
156 if (in == null) {
157 throw new NullPointerException("null input");
158 }
159 if (out == null) {
160 throw new NullPointerException("null output");
161 }
162 // Use the stream-based implementation.
163 // %%% Reconsider if native unpacker learns to memory-map the file.
164 try (FileInputStream instr = new FileInputStream(in)) {
165 unpack(instr, out);
166 }
167 if (props.getBoolean(Utils.UNPACK_REMOVE_PACKFILE)) {
168 in.delete();
169 }
170 }
171
172 private class DoUnpack {
173 final int verbose = props.getInteger(Utils.DEBUG_VERBOSE);
174
175 {
176 props.setInteger(Pack200.Unpacker.PROGRESS, 0);
177 }
178
179 // Here's where the bits are read from disk:
180 final Package pkg = new Package();
181
182 final boolean keepModtime
183 = Pack200.Packer.KEEP.equals(
184 props.getProperty(Utils.UNPACK_MODIFICATION_TIME, Pack200.Packer.KEEP));
185 final boolean keepDeflateHint
186 = Pack200.Packer.KEEP.equals(
|