1 55 56 package org.apache.bsf.util.event.generator; 57 58 69 public class Bytecode 70 { 71 public static final byte C_Utf8 = 0x01; public static final byte C_Integer = 0x03; public static final byte C_Float = 0x04; public static final byte C_Long = 0x05; public static final byte C_Double = 0x06; public static final byte C_Class = 0x07; public static final byte C_String = 0x08; public static final byte C_FieldRef = 0x09; public static final byte C_MethodRef = 0x0A; public static final byte C_InterfaceMethodRef = 0x0B; public static final byte C_NameAndType = 0x0C; 84 91 public static byte[] addClass(byte[] array,short value) 92 { return addRef(C_Class,array,value); } 93 public static byte[] addFieldRef(byte[] array,short value1,short value2) 94 { return addRef(C_FieldRef,array,value1,value2); } 95 public static byte[] addInteger(byte[] array,int value) 96 { 97 array = ByteUtility.addBytes(array,C_Integer); 98 array = ByteUtility.addBytes(array,value); 99 return array; 100 } 101 public static byte[] addInterfaceMethodRef(byte[] array,short value1,short value2) 102 { return addRef(C_InterfaceMethodRef,array,value1,value2); } 103 110 public static byte[] addLong(byte[] array,long value) 111 { 112 array = ByteUtility.addBytes(array,C_Long); 113 array = ByteUtility.addBytes(array,value); 114 return array; 115 } 116 public static byte[] addMethodRef(byte[] array,short value1,short value2) 117 { return addRef(C_MethodRef,array,value1,value2); } 118 public static byte[] addNameAndType(byte[] array,short value1,short value2) 119 { return addRef(C_NameAndType,array,value1,value2); } 120 public static byte[] addRef(byte refType,byte[] array,short value) 121 { 122 array = ByteUtility.addBytes(array,refType); 123 array = ByteUtility.addBytes(array,value); 124 return array; 125 } 126 public static byte[] addRef(byte refType,byte[] array,short value1,short value2) 128 { 129 array = ByteUtility.addBytes(array,refType); 130 array = ByteUtility.addBytes(array,value1); 131 array = ByteUtility.addBytes(array,value2); 132 return array; 133 } 134 public static byte[] addString(byte[] array,short value) 135 { return addRef(C_String,array,value); } 136 public static byte[] addUtf8(byte[] array,String value) 138 { 139 array = ByteUtility.addBytes(array,C_Utf8); 140 array = ByteUtility.addBytes(array,(short)value.length()); 141 array = ByteUtility.addBytes(array,value); 142 return array; 143 } 144 } 145 | Popular Tags |