home *** CD-ROM | disk | FTP | other *** search
/ Best Tools for JAVA / Best Tools for JAVA.iso / JAVA_ALL / IDE / DUMPCLAS.TAR / dumpclass.java < prev    next >
Encoding:
Java Source  |  1996-05-22  |  967 b   |  36 lines

  1. /*
  2.  * dumpclass.java
  3.  *
  4.  * Uses the class file decoders in util to dump out a
  5.  * class file.
  6.  * Written : 22 - May - 1996 by Chuck McManis
  7.  */
  8.  
  9. import util.*;
  10. import java.io.*;
  11.  
  12. public class dumpclass {
  13.     public static void main(String args[]) {
  14.         FileInputStream fis;
  15.         ClassFile cf = new ClassFile();
  16.         cf.debug = true;
  17.  
  18.  
  19.     /* Try to open arg[0] as the name of a .class file */
  20.         try { fis = new FileInputStream(args[0]); }
  21.         catch (IOException e) { fis = null; }
  22.  
  23.         try {
  24.         /* Read in the .class file (can throw various things) */
  25.             if (! cf.read(fis)) {
  26.                 System.out.println("Couldn't load "+args[0]+", press a key.");
  27.         int c = System.in.read(); /* this is for Symantec */
  28.         throw new Exception("File not parsed.");
  29.             }
  30.  
  31.             cf.display(System.out);
  32.         int c = System.in.read(); /* Keep screen open */
  33.         } catch (Exception e) { }
  34.     }
  35. }
  36.