/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A stripped-down version of Jar tool with a "-encoding" option to
* support non-UTF8 encoidng for entry name and comment.
*/
public class zip {
/*
* cflag: create
* uflag: update
* xflag: xtract
* tflag: table
* vflag: verbose
* flag0: no zip compression (store only)
*/
static {
try {
// just use the jar message
} catch (MissingResourceException e) {
throw new Error("Fatal: Resource for jar is missing");
}
}
}
private boolean ok;
ok = true;
return false;
}
try {
}
}
}
if (cflag) {
} else {
if (vflag) {
vflag = false;
}
}
} else if (uflag) {
} else {
vflag = false;
}
if (ok) {
}
}
}
} else if (tflag) {
} else {
try{
} finally {
}
}
} else if (xflag) {
} else {
: new FileInputStream(fname);
try {
} finally {
}
}
}
} catch (IOException e) {
fatalError(e);
ok = false;
ok = false;
} catch (Throwable t) {
t.printStackTrace();
ok = false;
}
return ok;
}
try {
} catch (FileNotFoundException e) {
return false;
} catch (IOException e) {
fatalError(e);
return false;
}
int count = 1;
try {
}
case 'c':
usageError();
return false;
}
cflag = true;
break;
case 'u':
usageError();
return false;
}
uflag = true;
break;
case 'x':
usageError();
return false;
}
xflag = true;
break;
case 't':
usageError();
return false;
}
tflag = true;
break;
case 'v':
vflag = true;
break;
case 'f':
break;
case '0':
flag0 = true;
break;
default:
usageError();
return false;
}
}
} catch (ArrayIndexOutOfBoundsException e) {
usageError();
return false;
}
usageError();
return false;
}
/* parse file arguments */
if (n > 0) {
int k = 0;
try {
/* change the directory */
}
} else {
}
}
} catch (ArrayIndexOutOfBoundsException e) {
e.printStackTrace();
usageError();
return false;
}
if (k != 0) {
}
usageError();
return false;
}
return true;
}
return;
}
File f;
} else {
}
if (f.isFile()) {
if (isUpdate)
}
} else if (f.isDirectory()) {
if (isUpdate) {
}
}
} else {
ok = false;
}
}
}
{
if (flag0) {
}
}
}
}
{
{
byte[] buf = new byte[1024];
int n = 0;
boolean updateOk = true;
// put the old entries first, replace if necessary
// do our own compression
}
}
} else { // replace with the new files
}
}
// add the remaining new files
}
}
return updateOk;
}
}
}
}
return name;
}
if (isDir) {
}
return;
}
if (vflag) {
}
if (size == 0) {
e.setSize(0);
e.setCrc(0);
} else if (flag0) {
}
zos.putNextEntry(e);
if (!isDir) {
byte[] buf = new byte[8192];
int len;
}
}
zos.closeEntry();
/* report how much compression occurred. */
if (vflag) {
long csize = e.getCompressedSize();
long ratio = 0;
if (size != 0) {
}
} else {
}
}
}
byte[] buf = new byte[8192];
int r = 0;
int nread = 0;
nread += r;
}
throw new ZipException(formatMsg(
"error.incorrect.length", f.getPath()));
}
}
}
}
}
}};
}
if (lastModified != -1) {
}
}
}
ZipEntry e;
} else {
break;
}
}
}
}
}
while (zes.hasMoreElements()) {
} else {
break;
}
}
}
}
}
}
if (e.isDirectory()) {
if (f.exists()) {
if (!f.isDirectory()) {
f.getPath()));
}
} else {
if (!f.mkdirs()) {
f.getPath()));
} else {
rc = e;
}
}
if (vflag) {
}
} else {
throw new IOException(formatMsg(
"error.create.dir", d.getPath()));
}
}
byte[] b = new byte[8192];
int len;
try {
}
} finally {
if (is instanceof ZipInputStream)
else
}
if (vflag) {
} else {
}
}
}
long lastModified = e.getTime();
if (lastModified != -1) {
}
return rc;
}
ZipEntry e;
zis.closeEntry();
printEntry(e, files);
}
}
while (zes.hasMoreElements()) {
}
}
}
printEntry(e);
} else {
printEntry(e);
return;
}
}
}
}
if (vflag) {
}
} else {
}
}
void usageError() {
"Usage: zip {ctxu}[vf0] [zip-file] [-encoding encname][-C dir] files ...\n" +
"Options:\n" +
" -c create new archive\n" +
" -t list table of contents for archive\n" +
" -x extract named (or all) files from archive\n" +
" -u update existing archive\n" +
" -v generate verbose output on standard output\n" +
" -f specify archive file name\n" +
" -0 store only; use no ZIP compression\n" +
" -C change to the specified directory and include the following file\n" +
"If any file is a directory then it is processed recursively.\n");
}
e.printStackTrace();
}
}
}
}
try {
} catch (MissingResourceException e) {
throw new Error("Error in message file");
}
}
}
}
{
} else {
}
} else {
}
}
}
{
st.resetSyntax();
}
r.close();
}
}
}