home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 March / maximum-cd-1999-03.iso / Feature / Lotus / ORGANIZE / COMPNENT / LTOUIN21.ZIP / sunw / demo / classfile / MethodDesc.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-12  |  1.7 KB  |  54 lines

  1. package sunw.demo.classfile;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5.  
  6. final class MethodDesc {
  7.    static final short ACC_PUBLIC = 1;
  8.    static final short ACC_PRIVATE = 2;
  9.    static final short ACC_PROTECTED = 4;
  10.    static final short ACC_STATIC = 8;
  11.    static final short ACC_FINAL = 16;
  12.    static final short ACC_SYNCHRONIZED = 32;
  13.    static final short ACC_NATIVE = 256;
  14.    static final short ACC_ABSTRACT = 1024;
  15.    private UTF8Constant name;
  16.    private UTF8Constant descriptor;
  17.    private short accessFlags;
  18.    private ClassFile classFile;
  19.    private Attribute[] attributes;
  20.  
  21.    MethodDesc(String var1, String var2, short var3, ClassFile var4, Code var5) {
  22.       this.name = new UTF8Constant(var1, var4);
  23.       this.descriptor = new UTF8Constant(var2, var4);
  24.       this.accessFlags = var3;
  25.       this.classFile = var4;
  26.       Attribute[] var6 = new Attribute[]{var5};
  27.       this.attributes = var6;
  28.    }
  29.  
  30.    MethodDesc(String var1, String var2, short var3, ClassFile var4, Attribute[] var5) {
  31.       this.name = new UTF8Constant(var1, var4);
  32.       this.descriptor = new UTF8Constant(var2, var4);
  33.       this.accessFlags = var3;
  34.       this.classFile = var4;
  35.       this.attributes = var5;
  36.    }
  37.  
  38.    void write(DataOutputStream var1) throws IOException {
  39.       var1.writeShort(this.accessFlags);
  40.       var1.writeShort(this.name.getConstantPoolIndex());
  41.       var1.writeShort(this.descriptor.getConstantPoolIndex());
  42.       if (this.attributes != null && this.attributes.length > 0) {
  43.          var1.writeShort(this.attributes.length);
  44.  
  45.          for(int var2 = 0; var2 < this.attributes.length; ++var2) {
  46.             this.attributes[var2].write(var1);
  47.          }
  48.       } else {
  49.          var1.writeShort(0);
  50.       }
  51.  
  52.    }
  53. }
  54.