• Aucun résultat trouvé

jcf-dump

Dans le document For Mary (Page 197-200)

Thejcf-dumputility lists information about the contents of a class file. Included with this information is a complete list of the values in the pool of constants, the superclasses, and interfaces, fields, and methods. Table 8-5 lists the options available for thejcf-dumputility.

Option Description

--bootclasspath=path Overrides the built-in classpath setting.

-c Disassembles the bytecodes of the method bodies.

--classpath=path Specifies the path to be used to locate class files.

--CLASSPATH=path Specifies the path to be used to locate class files.

--help Prints this list of options and exits.

-Idirectory Appends the specified directory onto the end of the classpath.

Table 8-5. The Command-Line Options forjcf-dump

USINGTHECOMPILERCOLLECTION

For example, the following command will dump to the internal information of the class file SwmpMilin.class to the file sm.dump:

$ jcf-dump SwmpMilin.class -o sm.dump

jv-scan

Thejv-scanutility reads and analyzes the contents of one or more Java source files and then prints information about them. Table 8-6 lists the command-line options available forjv-scan.

Option Description

--javap Generates the output in the same format asjavap.

The programjavapis provided as part of the standard Sun Microsystems Java distribution.

-o file Directs the output to the named file instead of to standard output.

-v Prints extra information during processing.

Same as--verbose.

--verbose Prints extra information during processing.

Same as-v.

--version Prints the version number and exits.

Table 8-5. The Command-Line Options forjcf-dump(continued)

Option Description

--complexity Prints the cyclomatic complexity value of each class.

The number is calculated by analyzing the control flow as a directed graph and counting the nodes, edges, and the number of connected components.

--encoding=name Specifies the encoding name of the particular character set to be used when reading the source. If a locale name is set, it is used; otherwise, UTF-8 is assumed.

Table 8-6. The Command-Line Options forjv-scan

jv-convert

Thejv-convertutility converts from one form of character encoding to another. The input defaults to being standard input but can also be the first file name listed on the command line or the file named with the-ioption. The output defaults to standard output but can also be the second file named on the command line or the file named with the-ooption. Table 8-7 lists the command-line options. For example, the following command will convert the contents of a file namedPierNun.unicontaining the Unicode 8-bit encoding format to a file namedPierNun.javain the format of Java source code with Unicode characters using\uescape sequences:

$ jv-convert --from UTF8 --to JavaSrc PierNun.uni PierNun.java The command-line options forjv-convertare listed in Table 8-7, and the types of encoding available are listed in Table 8-8.

There is no command that can be used to list the available conversion options.

Table 8-8 contains the encoding options that existed at the time of this writing, but more are almost certain to be added over time. To find out which ones are available for your compiler, look at the source code directory treegcc/libjava/gnu/gcj/

convertfor files with names of the formInput_*.candOuput_*.c, where the asterisk is the name of an encoding scheme that can be used as input or output, respectively. The conversion process uses Unicode as an internal, intermediate form, so any input/output pairs can be used together. Some conversions are platform dependent.

Option Description

--help Prints this list of options and exits.

--list-class Prints the names of the classes found in all the files on the command line.

--list-filename When used in conjunction with --list-class, the file name containing each class is also listed.

-o file The output is directed to the named file instead of to standard output.

--print-main Prints the names of the classes containing apublic static void main()method.

--version Prints the version number and exits.

Table 8-6. The Command-Line Options forjv-scan(continued)

USINGTHECOMPILERCOLLECTION

Option Description

--encoding name The name of the encoding scheme of the input data.

The default is the local computer’s locale encoding.

Same as--from.

--from name The name of the encoding scheme of the input data.

The default is the local computer’s locale encoding.

Same as--encoding.

--help Prints this list of options.

-i file The name of the input file.

-o file The name of the output file.

--reverse Reverses the specified--from and --to encodings.

-to name The name of the encoding scheme of the output data.

The default isJavaSrc, which is ASCII text with Java

\uXXXX hexadecimal encoding for non-ASCII characters.

--version Prints the version number ofjv-convert. Table 8-7. Command-Line Options forjv-convert

Encoding Name Description

8859_1 ISO-Latin-1 (8851-1) text.

ASCII The standard ASCII character set.

EUCJIS Extended UNIX Code for Japan.

JavaSrc The standard ASCII character set with embedded Java hexadecimal \uXXXX encoding for Unicode characters.

SJIS Shift JIS, which is used on Japanese Microsoft Windows.

UTF8 A form of encoding Unicode characters that preserves ASCII characters as 8-bit entities.

Table 8-8. Character Encodings Known tojv-convert

Dans le document For Mary (Page 197-200)