/** * Reads a ClassFile from the given InputStream. With this method, inner * classes cannot be loaded, and custom attributes cannot be defined. * * @param in source of class file data * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(InputStream in) throws IOException { return readFrom(in, null, null); }
/** * Reads a ClassFile from the given DataInput. With this method, inner * classes cannot be loaded, and custom attributes cannot be defined. * * @param din source of class file data * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(DataInput din) throws IOException { return readFrom(din, null, null); }
/** * Reads a ClassFile from the given DataInput. A * {@link ClassFileDataLoader} may be provided, which allows inner class * definitions to be loaded. Also, an {@link AttributeFactory} may be * provided, which allows non-standard attributes to be read. All * remaining unknown attribute types are captured, but are not decoded. * * @param din source of class file data * @param loader optional loader for reading inner class definitions * @param attrFactory optional factory for reading custom attributes * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(DataInput din, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { return readFrom(din, loader, attrFactory, new HashMap<String, ClassFile>(11), null); }
/** * Reads a ClassFile from the given InputStream. A * {@link ClassFileDataLoader} may be provided, which allows inner class * definitions to be loaded. Also, an {@link AttributeFactory} may be * provided, which allows non-standard attributes to be read. All * remaining unknown attribute types are captured, but are not decoded. * * @param in source of class file data * @param loader optional loader for reading inner class definitions * @param attrFactory optional factory for reading custom attributes * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(InputStream in, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory); }
private static ClassFile readOuterClass(ConstantClassInfo outer, ClassFileDataLoader loader, AttributeFactory attrFactory, Map<String, ClassFile> loadedClassFiles) throws IOException { String name = outer.getType().getRootName(); ClassFile outerClass = loadedClassFiles.get(name); if (outerClass != null) { return outerClass; } InputStream in = loader.getClassData(name); if (in == null) { return null; } if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory, loadedClassFiles, null); }
ClassFile cf = ClassFile.readFrom(in, loader, null);
private static ClassFile readInnerClass(ConstantClassInfo inner, ClassFileDataLoader loader, AttributeFactory attrFactory, Map<String, ClassFile> loadedClassFiles, ClassFile outerClass) throws IOException { String name = inner.getType().getRootName(); // Prevent cycles in inner class structure. for (ClassFile outer = outerClass; outer != null; outer = outer.getOuterClass()) { if (name.equals(outer.getClassName())) { // Cycle prevented. return null; } } // Prevent classes from being loaded multiple times. ClassFile innerClass = loadedClassFiles.get(name); if (innerClass != null) { return innerClass; } InputStream in = loader.getClassData(name); if (in == null) { return null; } if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory, loadedClassFiles, outerClass); }
cf = ClassFile.readFrom(in); } catch (IOException e) { MissingResourceException e2 = new MissingResourceException
/** * Reads a ClassFile from the given InputStream. With this method, inner * classes cannot be loaded, and custom attributes cannot be defined. * * @param in source of class file data * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(InputStream in) throws IOException { return readFrom(in, null, null); }
/** * Reads a ClassFile from the given DataInput. With this method, inner * classes cannot be loaded, and custom attributes cannot be defined. * * @param din source of class file data * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(DataInput din) throws IOException { return readFrom(din, null, null); }
/** * Reads a ClassFile from the given InputStream. A * {@link ClassFileDataLoader} may be provided, which allows inner class * definitions to be loaded. Also, an {@link AttributeFactory} may be * provided, which allows non-standard attributes to be read. All * remaining unknown attribute types are captured, but are not decoded. * * @param in source of class file data * @param loader optional loader for reading inner class definitions * @param attrFactory optional factory for reading custom attributes * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(InputStream in, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory); }
/** * Reads a ClassFile from the given DataInput. A * {@link ClassFileDataLoader} may be provided, which allows inner class * definitions to be loaded. Also, an {@link AttributeFactory} may be * provided, which allows non-standard attributes to be read. All * remaining unknown attribute types are captured, but are not decoded. * * @param din source of class file data * @param loader optional loader for reading inner class definitions * @param attrFactory optional factory for reading custom attributes * @throws IOException for I/O error or if classfile is invalid. * @throws ArrayIndexOutOfBoundsException if a constant pool index is out * of range. * @throws ClassCastException if a constant pool index references the * wrong type. */ public static ClassFile readFrom(DataInput din, ClassFileDataLoader loader, AttributeFactory attrFactory) throws IOException { return readFrom(din, loader, attrFactory, new HashMap<String, ClassFile>(11), null); }
private static ClassFile readOuterClass(ConstantClassInfo outer, ClassFileDataLoader loader, AttributeFactory attrFactory, Map<String, ClassFile> loadedClassFiles) throws IOException { String name = outer.getType().getRootName(); ClassFile outerClass = loadedClassFiles.get(name); if (outerClass != null) { return outerClass; } InputStream in = loader.getClassData(name); if (in == null) { return null; } if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory, loadedClassFiles, null); }
ClassFile cf = ClassFile.readFrom(in, loader, null);
private static ClassFile readInnerClass(ConstantClassInfo inner, ClassFileDataLoader loader, AttributeFactory attrFactory, Map<String, ClassFile> loadedClassFiles, ClassFile outerClass) throws IOException { String name = inner.getType().getRootName(); // Prevent cycles in inner class structure. for (ClassFile outer = outerClass; outer != null; outer = outer.getOuterClass()) { if (name.equals(outer.getClassName())) { // Cycle prevented. return null; } } // Prevent classes from being loaded multiple times. ClassFile innerClass = loadedClassFiles.get(name); if (innerClass != null) { return innerClass; } InputStream in = loader.getClassData(name); if (in == null) { return null; } if (!(in instanceof DataInput)) { in = new DataInputStream(in); } return readFrom((DataInput)in, loader, attrFactory, loadedClassFiles, outerClass); }
cf = ClassFile.readFrom(in); } catch (IOException e) { MissingResourceException e2 = new MissingResourceException
ClassFile cf = ClassFile.readFrom(in);
cf = ClassFile.readFrom(new ByteArrayInputStream(classfileBuffer)); } catch (Exception e) { IllegalClassFormatException e2 = new IllegalClassFormatException();