public final class ClassFileVersion
extends java.lang.Object
java ClassFileVersion MyClass.classSupplying the "-min JDKVER" argument suppresses output except for .class files that require at least that JDK version. For instance, to list all the .class/.jar files that require JDK 6 or later, in this or any subdirectory, run
find . \( -name '*.class' -o -name '*.jar' \) -print | xargs java ClassFileVersion -min 6
Modifier and Type | Method and Description |
---|---|
static void |
main(java.lang.String[] args)
Main method for the ClassFileVersion program.
|
static void |
processClassFile(java.lang.String filename,
java.io.InputStream is)
Print, to standard out, the version number for the class file found in is.
|
static double[] |
versionNumbers(java.io.InputStream is)
Return an array of the major vernios, minor version, and JDK version of the class read from the
input stream.
|
public static void main(java.lang.String[] args) throws java.io.IOException
args
- command-line argumentsjava.io.IOException
- if a file cannot be readpublic static void processClassFile(java.lang.String filename, java.io.InputStream is)
filename
- file name to appear in printed messagesis
- input stream from which to read classfile bytes to processpublic static double[] versionNumbers(java.io.InputStream is)
is
- input stream from which to read a class