View | Details | Raw Unified | Return to bug 56953
Collapse All | Expand All

(-)apache/tomcat/util/bcel/classfile/Constant.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
22
23
import org.apache.tomcat.util.bcel.Constants;
23
import org.apache.tomcat.util.bcel.Constants;
Lines 62-68 Link Here
62
     * @param file Input stream
62
     * @param file Input stream
63
     * @return Constant object
63
     * @return Constant object
64
     */
64
     */
65
    static Constant readConstant( DataInputStream file ) throws IOException,
65
    static Constant readConstant( DataInput file ) throws IOException,
66
            ClassFormatException {
66
            ClassFormatException {
67
        byte b = file.readByte(); // Read tag byte
67
        byte b = file.readByte(); // Read tag byte
68
        int skipSize;
68
        int skipSize;
(-)apache/tomcat/util/bcel/classfile/Annotations.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
22
23
/**
23
/**
Lines 34-40 Link Here
34
     * @param file Input stream
34
     * @param file Input stream
35
     * @param constant_pool Array of constants
35
     * @param constant_pool Array of constants
36
     */
36
     */
37
    Annotations(DataInputStream file, ConstantPool constant_pool)
37
    Annotations(DataInput file, ConstantPool constant_pool)
38
            throws IOException {
38
            throws IOException {
39
        final int annotation_table_length = (file.readUnsignedShort());
39
        final int annotation_table_length = (file.readUnsignedShort());
40
        annotation_table = new AnnotationEntry[annotation_table_length];
40
        annotation_table = new AnnotationEntry[annotation_table_length];
(-)apache/tomcat/util/bcel/classfile/ConstantUtf8.java (-2 / +2 lines)
Lines 16-22 Link Here
16
 */
16
 */
17
package org.apache.tomcat.util.bcel.classfile;
17
package org.apache.tomcat.util.bcel.classfile;
18
18
19
import java.io.DataInputStream;
19
import java.io.DataInput;
20
import java.io.IOException;
20
import java.io.IOException;
21
21
22
import org.apache.tomcat.util.bcel.Constants;
22
import org.apache.tomcat.util.bcel.Constants;
Lines 34-40 Link Here
34
    private final String bytes;
34
    private final String bytes;
35
35
36
36
37
    static ConstantUtf8 getInstance(DataInputStream file) throws IOException {
37
    static ConstantUtf8 getInstance(DataInput file) throws IOException {
38
        return new ConstantUtf8(file.readUTF());
38
        return new ConstantUtf8(file.readUTF());
39
    }
39
    }
40
40
(-)apache/tomcat/util/bcel/classfile/ElementValuePair.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
22
23
import org.apache.tomcat.util.bcel.Constants;
23
import org.apache.tomcat.util.bcel.Constants;
Lines 36-42 Link Here
36
36
37
    private final int elementNameIndex;
37
    private final int elementNameIndex;
38
38
39
    ElementValuePair(DataInputStream file, ConstantPool constantPool) throws IOException {
39
    ElementValuePair(DataInput file, ConstantPool constantPool) throws IOException {
40
        this.constantPool = constantPool;
40
        this.constantPool = constantPool;
41
        this.elementNameIndex = file.readUnsignedShort();
41
        this.elementNameIndex = file.readUnsignedShort();
42
        this.elementValue = ElementValue.readElementValue(file, constantPool);
42
        this.elementValue = ElementValue.readElementValue(file, constantPool);
(-)apache/tomcat/util/bcel/classfile/AnnotationEntry.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
import java.util.ArrayList;
22
import java.util.ArrayList;
23
import java.util.List;
23
import java.util.List;
Lines 44-50 Link Here
44
     * @param constant_pool
44
     * @param constant_pool
45
     * @throws IOException
45
     * @throws IOException
46
     */
46
     */
47
    AnnotationEntry(DataInputStream file, ConstantPool constant_pool) throws IOException {
47
    AnnotationEntry(DataInput file, ConstantPool constant_pool) throws IOException {
48
48
49
        this.constant_pool = constant_pool;
49
        this.constant_pool = constant_pool;
50
50
(-)apache/tomcat/util/bcel/classfile/ConstantPool.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
22
23
import org.apache.tomcat.util.bcel.Constants;
23
import org.apache.tomcat.util.bcel.Constants;
Lines 45-51 Link Here
45
     * @throws IOException
45
     * @throws IOException
46
     * @throws ClassFormatException
46
     * @throws ClassFormatException
47
     */
47
     */
48
    ConstantPool(DataInputStream file) throws IOException, ClassFormatException {
48
    ConstantPool(DataInput file) throws IOException, ClassFormatException {
49
        int constant_pool_count = file.readUnsignedShort();
49
        int constant_pool_count = file.readUnsignedShort();
50
        constant_pool = new Constant[constant_pool_count];
50
        constant_pool = new Constant[constant_pool_count];
51
        /* constant_pool[0] is unused by the compiler and may be used freely
51
        /* constant_pool[0] is unused by the compiler and may be used freely
(-)apache/tomcat/util/bcel/classfile/ClassParser.java (-2 / +10 lines)
Lines 18-28 Link Here
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.BufferedInputStream;
20
import java.io.BufferedInputStream;
21
import java.io.DataInput;
21
import java.io.DataInputStream;
22
import java.io.DataInputStream;
22
import java.io.IOException;
23
import java.io.IOException;
23
import java.io.InputStream;
24
import java.io.InputStream;
24
25
25
import org.apache.tomcat.util.bcel.Constants;
26
import org.apache.tomcat.util.bcel.Constants;
27
import org.apache.tomcat.util.bcel.util.FastDataInputStream;
26
28
27
/**
29
/**
28
 * Wrapper class that parses a given Java .class file. The method <A
30
 * Wrapper class that parses a given Java .class file. The method <A
Lines 40-48 Link Here
40
 */
42
 */
41
public final class ClassParser {
43
public final class ClassParser {
42
44
45
	//switch for FastDataInputStream
46
	public static boolean isFDIS = true;
47
	
43
    private static final int MAGIC = 0xCAFEBABE;
48
    private static final int MAGIC = 0xCAFEBABE;
44
49
45
    private final DataInputStream file;
50
    private final DataInput file;
46
    private String class_name, superclass_name;
51
    private String class_name, superclass_name;
47
    private int access_flags; // Access rights of parsed class
52
    private int access_flags; // Access rights of parsed class
48
    private String[] interface_names; // Names of implemented interfaces
53
    private String[] interface_names; // Names of implemented interfaces
Lines 58-64 Link Here
58
     * @param file Input stream
63
     * @param file Input stream
59
     */
64
     */
60
    public ClassParser(InputStream file) {
65
    public ClassParser(InputStream file) {
61
        this.file = new DataInputStream(new BufferedInputStream(file, BUFSIZE));
66
        if(isFDIS){
67
        	this.file = new FastDataInputStream(file, BUFSIZE);
68
        } else
69
        	this.file = new DataInputStream(new BufferedInputStream(file, BUFSIZE));
62
    }
70
    }
63
71
64
72
(-)apache/tomcat/util/bcel/classfile/ElementValue.java (-2 / +2 lines)
Lines 17-23 Link Here
17
 */
17
 */
18
package org.apache.tomcat.util.bcel.classfile;
18
package org.apache.tomcat.util.bcel.classfile;
19
19
20
import java.io.DataInputStream;
20
import java.io.DataInput;
21
import java.io.IOException;
21
import java.io.IOException;
22
22
23
/**
23
/**
Lines 64-70 Link Here
64
64
65
    public static final int PRIMITIVE_BOOLEAN = 'Z';
65
    public static final int PRIMITIVE_BOOLEAN = 'Z';
66
66
67
    public static ElementValue readElementValue(DataInputStream dis,
67
    public static ElementValue readElementValue(DataInput dis,
68
            ConstantPool cpool) throws IOException
68
            ConstantPool cpool) throws IOException
69
    {
69
    {
70
        byte type = dis.readByte();
70
        byte type = dis.readByte();

Return to bug 56953