sofya.viewers
Class ByteSourceViewer

java.lang.Object
  extended by sofya.viewers.Viewer
      extended by sofya.viewers.ByteSourceViewer

public class ByteSourceViewer
extends Viewer

The ByteSourceViewer is used to display a human-readable listing of the compiled Java bytecode for a class. Instructions are listed using the assembly mnemonics defined by the Java Virtual Machine specification.

Usage:
java sofya.viewers.ByteSourceViewer <SourceFile> [OutputFile]
     [OutputFile] : Redirect output of viewer to OutputFile
     (Do not include .class extension with SourceFile)

Version:
04/05/2004
Author:
Alex Kinneer

Field Summary
 
Fields inherited from class sofya.viewers.Viewer
destStream, inputFile, LINE_SEP, outputFile, stdin
 
Constructor Summary
ByteSourceViewer(java.lang.String inputFile)
          Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the system console (System.out).
ByteSourceViewer(java.lang.String inputFile, java.io.OutputStream stream)
          Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the specified output stream.
ByteSourceViewer(java.lang.String inputFile, java.lang.String outputFile)
          Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the specified output file.
 
Method Summary
static void main(java.lang.String[] argv)
          Entry point for ByteSourceViewer.
 void print(java.io.PrintWriter stream)
          Prints the bytecode for the Java class to the specified stream.
 
Methods inherited from class sofya.viewers.Viewer
print, printMethodName, rightJust, setInputFile, setOutputFile, setOutputStream, sizeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteSourceViewer

public ByteSourceViewer(java.lang.String inputFile)
Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the system console (System.out).

Parameters:
inputFile - Name of the Java class whose bytecode is to be displayed.

ByteSourceViewer

public ByteSourceViewer(java.lang.String inputFile,
                        java.lang.String outputFile)
                 throws SameFileNameException,
                        java.io.IOException
Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the specified output file.

Parameters:
inputFile - Name of the Java class whose bytecode is to be displayed.
outputFile - Name of the file to which the viewer output should be written.
Throws:
SameFileNameException - If the specified output file and input file are the same file.
java.io.IOException - If there is an error creating the output file.

ByteSourceViewer

public ByteSourceViewer(java.lang.String inputFile,
                        java.io.OutputStream stream)
Standard constructor, creates a ByteSourceViewer to display the contents of the specified Java class to the specified output stream.

Note: When using Viewer.print(), an output file specified using Viewer.setOutputFile(java.lang.String) takes precedence over the specified stream.

Parameters:
inputFile - Name of the Java class whose bytecode is to be displayed.
stream - Stream to which the viewer output should be written.
Method Detail

print

public void print(java.io.PrintWriter stream)
           throws java.io.IOException
Prints the bytecode for the Java class to the specified stream.

Specified by:
print in class Viewer
Parameters:
stream - Stream to which the bytecode should be written.
Throws:
java.io.IOException - If there is an error writing to the stream, or creating the output file, if applicable.

main

public static void main(java.lang.String[] argv)
Entry point for ByteSourceViewer.