< prev index next >

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

Print this page
rev 48343 : imported patch JDK-8173382-classfile-version


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




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


< prev index next >