ASF Bugzilla – Attachment 32029 Details for
Bug 56953
A improvement for "DataInputStream"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
change DataInputStream to DataInput
interfaceChanging.diff (text/plain), 7.23 KB, created by
hzhang9
on 2014-09-17 08:53:03 UTC
(
hide
)
Description:
change DataInputStream to DataInput
Filename:
MIME Type:
Creator:
hzhang9
Created:
2014-09-17 08:53:03 UTC
Size:
7.23 KB
patch
obsolete
>Index: apache/tomcat/util/bcel/classfile/Constant.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/Constant.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/Constant.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > import org.apache.tomcat.util.bcel.Constants; >@@ -62,7 +62,7 @@ > * @param file Input stream > * @return Constant object > */ >- static Constant readConstant( DataInputStream file ) throws IOException, >+ static Constant readConstant( DataInput file ) throws IOException, > ClassFormatException { > byte b = file.readByte(); // Read tag byte > int skipSize; >Index: apache/tomcat/util/bcel/classfile/Annotations.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/Annotations.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/Annotations.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > /** >@@ -34,7 +34,7 @@ > * @param file Input stream > * @param constant_pool Array of constants > */ >- Annotations(DataInputStream file, ConstantPool constant_pool) >+ Annotations(DataInput file, ConstantPool constant_pool) > throws IOException { > final int annotation_table_length = (file.readUnsignedShort()); > annotation_table = new AnnotationEntry[annotation_table_length]; >Index: apache/tomcat/util/bcel/classfile/ConstantUtf8.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/ConstantUtf8.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/ConstantUtf8.java (working copy) >@@ -16,7 +16,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > import org.apache.tomcat.util.bcel.Constants; >@@ -34,7 +34,7 @@ > private final String bytes; > > >- static ConstantUtf8 getInstance(DataInputStream file) throws IOException { >+ static ConstantUtf8 getInstance(DataInput file) throws IOException { > return new ConstantUtf8(file.readUTF()); > } > >Index: apache/tomcat/util/bcel/classfile/ElementValuePair.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/ElementValuePair.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/ElementValuePair.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > import org.apache.tomcat.util.bcel.Constants; >@@ -36,7 +36,7 @@ > > private final int elementNameIndex; > >- ElementValuePair(DataInputStream file, ConstantPool constantPool) throws IOException { >+ ElementValuePair(DataInput file, ConstantPool constantPool) throws IOException { > this.constantPool = constantPool; > this.elementNameIndex = file.readUnsignedShort(); > this.elementValue = ElementValue.readElementValue(file, constantPool); >Index: apache/tomcat/util/bcel/classfile/AnnotationEntry.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/AnnotationEntry.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/AnnotationEntry.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > import java.util.ArrayList; > import java.util.List; >@@ -44,7 +44,7 @@ > * @param constant_pool > * @throws IOException > */ >- AnnotationEntry(DataInputStream file, ConstantPool constant_pool) throws IOException { >+ AnnotationEntry(DataInput file, ConstantPool constant_pool) throws IOException { > > this.constant_pool = constant_pool; > >Index: apache/tomcat/util/bcel/classfile/ConstantPool.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/ConstantPool.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/ConstantPool.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > import org.apache.tomcat.util.bcel.Constants; >@@ -45,7 +45,7 @@ > * @throws IOException > * @throws ClassFormatException > */ >- ConstantPool(DataInputStream file) throws IOException, ClassFormatException { >+ ConstantPool(DataInput file) throws IOException, ClassFormatException { > int constant_pool_count = file.readUnsignedShort(); > constant_pool = new Constant[constant_pool_count]; > /* constant_pool[0] is unused by the compiler and may be used freely >Index: apache/tomcat/util/bcel/classfile/ClassParser.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/ClassParser.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/ClassParser.java (working copy) >@@ -18,11 +18,13 @@ > package org.apache.tomcat.util.bcel.classfile; > > import java.io.BufferedInputStream; >+import java.io.DataInput; > import java.io.DataInputStream; > import java.io.IOException; > import java.io.InputStream; > > import org.apache.tomcat.util.bcel.Constants; >+import org.apache.tomcat.util.bcel.util.FastDataInputStream; > > /** > * Wrapper class that parses a given Java .class file. The method <A >@@ -40,9 +42,12 @@ > */ > public final class ClassParser { > >+ //switch for FastDataInputStream >+ public static boolean isFDIS = true; >+ > private static final int MAGIC = 0xCAFEBABE; > >- private final DataInputStream file; >+ private final DataInput file; > private String class_name, superclass_name; > private int access_flags; // Access rights of parsed class > private String[] interface_names; // Names of implemented interfaces >@@ -58,7 +63,10 @@ > * @param file Input stream > */ > public ClassParser(InputStream file) { >- this.file = new DataInputStream(new BufferedInputStream(file, BUFSIZE)); >+ if(isFDIS){ >+ this.file = new FastDataInputStream(file, BUFSIZE); >+ } else >+ this.file = new DataInputStream(new BufferedInputStream(file, BUFSIZE)); > } > > >Index: apache/tomcat/util/bcel/classfile/ElementValue.java >=================================================================== >--- apache/tomcat/util/bcel/classfile/ElementValue.java (revision 1625454) >+++ apache/tomcat/util/bcel/classfile/ElementValue.java (working copy) >@@ -17,7 +17,7 @@ > */ > package org.apache.tomcat.util.bcel.classfile; > >-import java.io.DataInputStream; >+import java.io.DataInput; > import java.io.IOException; > > /** >@@ -64,7 +64,7 @@ > > public static final int PRIMITIVE_BOOLEAN = 'Z'; > >- public static ElementValue readElementValue(DataInputStream dis, >+ public static ElementValue readElementValue(DataInput dis, > ConstantPool cpool) throws IOException > { > byte type = dis.readByte();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 56953
:
31993
|
31994
|
32008
| 32029 |
32030
|
32031