org.python.compiler.ClassFile Maven / Gradle / Ivy
Go to download
Jython is an implementation of the high-level, dynamic, object-oriented
language Python written in 100% Pure Java, and seamlessly integrated with
the Java platform. It thus allows you to run Python on any Java platform.
// Copyright (c) Corporation for National Research Initiatives
package org.python.compiler;
import java.util.*;
import java.io.*;
class Method
{
int access, name, type;
Attribute[] atts;
public Method(int name, int type, int access, Attribute[] atts) {
this.name = name;
this.type = type;
this.access = access;
this.atts = atts;
}
public void write(DataOutputStream stream) throws IOException {
stream.writeShort(access);
stream.writeShort(name);
stream.writeShort(type);
ClassFile.writeAttributes(stream, atts);
}
}
public class ClassFile
{
ConstantPool pool;
int access;
public String name;
String superclass;
int[] interfaces;
Vector methods;
Vector fields;
Vector attributes;
public final static int PUBLIC = 0x1;
public final static int PRIVATE = 0x2;
public final static int PROTECTED = 0x4;
public final static int STATIC = 0x8;
public final static int FINAL = 0x10;
public final static int SYNCHRONIZED = 0x20;
public final static int NATIVE = 0x100;
public final static int ABSTRACT = 0x400;
public static String fixName(String n) {
if (n.indexOf('.') == -1)
return n;
char[] c = n.toCharArray();
for(int i=0; i