|
SoftNet-Consult Java Utility Library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softnetConsult.utils.reflect.ClassFileVersionTool
public class ClassFileVersionTool
This class implements a small executable tool that can analyse a Java class file,
a directory, or a Java archive (JAR or ZIP) and print version information for Java
class binaries found. This tool uses the library methods
SystemTools.getClassVersionInfo(File)
and
ClassTools.getClassVersionInfo(InputStream)
for the actual parsing of Java class binaries.
For usage and command line arguments, see printUsage()
and main(String[])
.
This product includes software developed by the
SoftNet-Consult Java Utility Library project and its contributors.
(http://java-tools.sourceforge.net)
Copyright (c) 2007-2008 SoftNet-Consult.
Copyright (c) 2007-2008 G. Paperin.
All rights reserved.
File: ClassFileVersionTool.java
Library API version: "2.02"
Java compliance version: "1.5"
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:
1. Redistributions of source code must retain the above
acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the
SoftNet-Consult Java Utility Library project, the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or other materials
provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived
software must display the following acknowledgement:
This product includes software developed by the SoftNet-Consult Java Utility Library
project and its contributors.
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Constructor Summary | |
---|---|
ClassFileVersionTool()
|
Method Summary | |
---|---|
static void |
exec(java.lang.String path,
boolean recursive)
The actual main program. |
static void |
main(java.lang.String[] args)
This executable program prints version information about all Java class files within a specified subdirectory. |
private static void |
printInfo(java.lang.String name,
ClassVersionInfo info,
ScreenFileLogger out)
Prints version info for a class binary in a nice looing way. |
private static void |
printUsage()
Used internally to print detailed information about the command line parameters. |
private static void |
procClass(java.io.File classfile,
ScreenFileLogger out)
Analyses the specified Java binary and prints its version info. |
private static void |
procDir(java.io.File dir,
boolean recursive,
ScreenFileLogger out)
Analyses the specified directory and prints the version info for all Java class files contained therein. |
private static void |
procZip(java.io.File archive,
ScreenFileLogger out)
Analyses the specified archive and prints the version info for all Java class files contained therein. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClassFileVersionTool()
Method Detail |
---|
private static void printInfo(java.lang.String name, ClassVersionInfo info, ScreenFileLogger out)
name
- File name of class file.info
- Version info.out
- The indenting screen logger to use for all output.private static void procClass(java.io.File classfile, ScreenFileLogger out)
classfile
- The class binary to analyse.out
- The indenting screen logger to use for all output.private static void procZip(java.io.File archive, ScreenFileLogger out)
archive
- The archive to analyse.out
- The indenting screen logger to use for all output.private static void procDir(java.io.File dir, boolean recursive, ScreenFileLogger out)
dir
- The directory to analyse.recursive
- Whther to recursively analyse subdirectories and archived contained
therein. Anchives within archives are not analysed.out
- The indenting screen logger to use for all output.public static void exec(java.lang.String path, boolean recursive)
path
- A path of a class binary, a directory or a Java archive (ZIP or JAR).recursive
- Whther to recursively analyse subdirectories and archived contained
therein. Anchives within archives are not analysed.private static void printUsage()
public static void main(java.lang.String[] args)
args
- Command line parameters:-R
to request recursive analysis of all subdirectories.printUsage()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |