< prev index next >

jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/ClassReader.java

Print this page




 178      * @param b
 179      *            the bytecode of the class to be read.
 180      */
 181     public ClassReader(final byte[] b) {
 182         this(b, 0, b.length);
 183     }
 184 
 185     /**
 186      * Constructs a new {@link ClassReader} object.
 187      *
 188      * @param b
 189      *            the bytecode of the class to be read.
 190      * @param off
 191      *            the start offset of the class data.
 192      * @param len
 193      *            the length of the class data.
 194      */
 195     public ClassReader(final byte[] b, final int off, final int len) {
 196         this.b = b;
 197         // checks the class version
 198         if (readShort(off + 6) > Opcodes.V1_9) {
 199             throw new IllegalArgumentException();
 200         }
 201         // parses the constant pool
 202         items = new int[readUnsignedShort(off + 8)];
 203         int n = items.length;
 204         strings = new String[n];
 205         int max = 0;
 206         int index = off + 10;
 207         for (int i = 1; i < n; ++i) {
 208             items[i] = index + 1;
 209             int size;
 210             switch (b[index]) {
 211             case ClassWriter.FIELD:
 212             case ClassWriter.METH:
 213             case ClassWriter.IMETH:
 214             case ClassWriter.INT:
 215             case ClassWriter.FLOAT:
 216             case ClassWriter.NAME_TYPE:
 217             case ClassWriter.INDY:
 218                 size = 5;




 178      * @param b
 179      *            the bytecode of the class to be read.
 180      */
 181     public ClassReader(final byte[] b) {
 182         this(b, 0, b.length);
 183     }
 184 
 185     /**
 186      * Constructs a new {@link ClassReader} object.
 187      *
 188      * @param b
 189      *            the bytecode of the class to be read.
 190      * @param off
 191      *            the start offset of the class data.
 192      * @param len
 193      *            the length of the class data.
 194      */
 195     public ClassReader(final byte[] b, final int off, final int len) {
 196         this.b = b;
 197         // checks the class version
 198         if (readShort(off + 6) > Opcodes.V_MAX) {
 199             throw new IllegalArgumentException();
 200         }
 201         // parses the constant pool
 202         items = new int[readUnsignedShort(off + 8)];
 203         int n = items.length;
 204         strings = new String[n];
 205         int max = 0;
 206         int index = off + 10;
 207         for (int i = 1; i < n; ++i) {
 208             items[i] = index + 1;
 209             int size;
 210             switch (b[index]) {
 211             case ClassWriter.FIELD:
 212             case ClassWriter.METH:
 213             case ClassWriter.IMETH:
 214             case ClassWriter.INT:
 215             case ClassWriter.FLOAT:
 216             case ClassWriter.NAME_TYPE:
 217             case ClassWriter.INDY:
 218                 size = 5;


< prev index next >