28 import java.io.BufferedInputStream; |
28 import java.io.BufferedInputStream; |
29 import java.io.ByteArrayInputStream; |
29 import java.io.ByteArrayInputStream; |
30 import java.io.DataInputStream; |
30 import java.io.DataInputStream; |
31 import java.io.IOException; |
31 import java.io.IOException; |
32 import java.io.InputStream; |
32 import java.io.InputStream; |
|
33 import java.util.Objects; |
33 |
34 |
34 /** |
35 /** |
35 * <p><b>This is NOT part of any supported API. |
36 * <p><b>This is NOT part of any supported API. |
36 * If you write code that depends on this, you do so at your own risk. |
37 * If you write code that depends on this, you do so at your own risk. |
37 * This code and its internal interfaces are subject to change or |
38 * This code and its internal interfaces are subject to change or |
38 * deletion without notice.</b> |
39 * deletion without notice.</b> |
39 */ |
40 */ |
40 public class ClassReader { |
41 public class ClassReader { |
41 ClassReader(ClassFile classFile, InputStream in, Attribute.Factory attributeFactory) throws IOException { |
42 ClassReader(ClassFile classFile, InputStream in, Attribute.Factory attributeFactory) throws IOException { |
42 // null checks |
43 this.classFile = Objects.requireNonNull(classFile); |
43 classFile.getClass(); |
44 this.attributeFactory = Objects.requireNonNull(attributeFactory); |
44 attributeFactory.getClass(); |
|
45 |
|
46 this.classFile = classFile; |
|
47 this.in = new DataInputStream(new BufferedInputStream(in)); |
45 this.in = new DataInputStream(new BufferedInputStream(in)); |
48 this.attributeFactory = attributeFactory; |
|
49 } |
46 } |
50 |
47 |
51 ClassFile getClassFile() { |
48 ClassFile getClassFile() { |
52 return classFile; |
49 return classFile; |
53 } |
50 } |