You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by pe...@apache.org on 2005/01/25 13:33:31 UTC
cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/jlink jlink.java
peterreilly 2005/01/25 04:33:31
Modified: src/main/org/apache/tools/ant/taskdefs/optional/jlink
jlink.java
Log:
javadoc + style
Obtained from: Kevin Jackson
Revision Changes Path
1.16 +62 -33 ant/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java
Index: jlink.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/jlink/jlink.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- jlink.java 9 Mar 2004 16:48:30 -0000 1.15
+++ jlink.java 25 Jan 2005 12:33:31 -0000 1.16
@@ -1,5 +1,5 @@
/*
- * Copyright 2000,2002-2004 The Apache Software Foundation
+ * Copyright 2000,2002-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,9 +36,25 @@
import java.util.zip.ZipFile;
import java.util.zip.ZipOutputStream;
-public class jlink extends Object {
+/**
+ * jlink links together multiple .jar files.
+ */
+public class jlink {
+
+
+ private String outfile = null;
+
+ private Vector mergefiles = new Vector(10);
+
+ private Vector addfiles = new Vector(10);
- /** The file that will be created by this instance of jlink. */
+ private boolean compression = false;
+
+ byte[] buffer = new byte[8192];
+
+ /** The file that will be created by this instance of jlink.
+ * @param outfile the file to create.
+ */
public void setOutfile(String outfile) {
if (outfile == null) {
return;
@@ -47,47 +63,61 @@
}
- /** Adds a file to be merged into the output. */
- public void addMergeFile(String mergefile) {
- if (mergefile == null) {
+ /**
+ * Adds a file to be merged into the output.
+ * @param fileToMerge the file to merge into the output.
+ */
+ public void addMergeFile(String fileToMerge) {
+ if (fileToMerge == null) {
return;
}
- mergefiles.addElement(mergefile);
+ mergefiles.addElement(fileToMerge);
}
- /** Adds a file to be added into the output. */
- public void addAddFile(String addfile) {
- if (addfile == null) {
+ /** Adds a file to be added into the output.
+ * @param fileToAdd the file to add to the output.
+ */
+ public void addAddFile(String fileToAdd) {
+ if (fileToAdd == null) {
return;
}
- addfiles.addElement(addfile);
+ addfiles.addElement(fileToAdd);
}
- /** Adds several files to be merged into the output. */
- public void addMergeFiles(String[] mergefiles) {
- if (mergefiles == null) {
+ /**
+ * Adds several files to be merged into the output.
+ * @param filesToMerge an array of files to merge into the output.
+ */
+ public void addMergeFiles(String[] filesToMerge) {
+ if (filesToMerge == null) {
return;
}
- for (int i = 0; i < mergefiles.length; i++) {
- addMergeFile(mergefiles[i]);
+ for (int i = 0; i < filesToMerge.length; i++) {
+ addMergeFile(filesToMerge[i]);
}
}
- /** Adds several file to be added into the output. */
- public void addAddFiles(String[] addfiles) {
- if (addfiles == null) {
+ /**
+ * Adds several file to be added into the output.
+ * @param filesToAdd an array of files to add to the output.
+ */
+ public void addAddFiles(String[] filesToAdd) {
+ if (filesToAdd == null) {
return;
}
- for (int i = 0; i < addfiles.length; i++) {
- addAddFile(addfiles[i]);
+ for (int i = 0; i < filesToAdd.length; i++) {
+ addAddFile(filesToAdd[i]);
}
}
- /** Determines whether output will be compressed. */
+ /**
+ * Determines whether output will be compressed.
+ * @param compress if true use compression.
+ */
public void setCompression(boolean compress) {
this.compression = compress;
}
@@ -103,6 +133,7 @@
* the root entry of all the files below it. Thus, you can provide
* multiple, disjoint directories, as addfiles: they will all be added in
* a rational manner to outfile.
+ * @throws Exception on error.
*/
public void link() throws Exception {
ZipOutputStream output = new ZipOutputStream(new FileOutputStream(outfile));
@@ -147,11 +178,16 @@
try {
output.close();
} catch (IOException ioe) {
+ //do nothing
}
}
}
+ /**
+ * The command line entry point for jlink.
+ * @param args an array of arguments
+ */
public static void main(String[] args) {
// jlink output input1 ... inputN
if (args.length < 2) {
@@ -271,11 +307,13 @@
return className.replace('.', '/') + ".class";
}
} catch (IOException ioe) {
+ //do nothing
} finally {
if (input != null) {
try {
input.close();
} catch (IOException e) {
+ //do nothing
}
}
}
@@ -336,7 +374,7 @@
* The big deal is to set the right parameters in the ZipEntry
* on the output stream.
*/
- private ZipEntry processEntry(ZipFile zip, ZipEntry inputEntry) throws IOException {
+ private ZipEntry processEntry(ZipFile zip, ZipEntry inputEntry) {
/*
First, some notes.
On MRJ 2.2.2, getting the size, compressed size, and CRC32 from the
@@ -361,6 +399,7 @@
name = className.replace('.', '/') + ".class";
}
} catch (IOException ioe) {
+ //do nothing
}
}
ZipEntry outputEntry = new ZipEntry(name);
@@ -410,16 +449,6 @@
return crc.getValue();
}
-
- private String outfile = null;
-
- private Vector mergefiles = new Vector(10);
-
- private Vector addfiles = new Vector(10);
-
- private boolean compression = false;
-
- byte[] buffer = new byte[8192];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org