home *** CD-ROM | disk | FTP | other *** search
- package sunw.demo.classfile;
-
- import java.io.DataOutputStream;
- import java.io.IOException;
-
- final class MethodDesc {
- static final short ACC_PUBLIC = 1;
- static final short ACC_PRIVATE = 2;
- static final short ACC_PROTECTED = 4;
- static final short ACC_STATIC = 8;
- static final short ACC_FINAL = 16;
- static final short ACC_SYNCHRONIZED = 32;
- static final short ACC_NATIVE = 256;
- static final short ACC_ABSTRACT = 1024;
- private UTF8Constant name;
- private UTF8Constant descriptor;
- private short accessFlags;
- private ClassFile classFile;
- private Attribute[] attributes;
-
- MethodDesc(String var1, String var2, short var3, ClassFile var4, Code var5) {
- this.name = new UTF8Constant(var1, var4);
- this.descriptor = new UTF8Constant(var2, var4);
- this.accessFlags = var3;
- this.classFile = var4;
- Attribute[] var6 = new Attribute[]{var5};
- this.attributes = var6;
- }
-
- MethodDesc(String var1, String var2, short var3, ClassFile var4, Attribute[] var5) {
- this.name = new UTF8Constant(var1, var4);
- this.descriptor = new UTF8Constant(var2, var4);
- this.accessFlags = var3;
- this.classFile = var4;
- this.attributes = var5;
- }
-
- void write(DataOutputStream var1) throws IOException {
- var1.writeShort(this.accessFlags);
- var1.writeShort(this.name.getConstantPoolIndex());
- var1.writeShort(this.descriptor.getConstantPoolIndex());
- if (this.attributes != null && this.attributes.length > 0) {
- var1.writeShort(this.attributes.length);
-
- for(int var2 = 0; var2 < this.attributes.length; ++var2) {
- this.attributes[var2].write(var1);
- }
- } else {
- var1.writeShort(0);
- }
-
- }
- }
-