[Jarspy-commits] CVS: JarSpy/src/com/ociweb/classinfo ClassReader.java,1.6,1.7
Status: Beta
Brought to you by:
brown_j
|
From: Jeff B. <br...@us...> - 2002-09-18 22:56:16
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/classinfo
In directory usw-pr-cvs1:/tmp/cvs-serv4298
Modified Files:
ClassReader.java
Log Message:
change code that reads in field and method attributes
to be more efficient
Index: ClassReader.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/classinfo/ClassReader.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ClassReader.java 13 Sep 2002 23:13:13 -0000 1.6
--- ClassReader.java 18 Sep 2002 22:56:13 -0000 1.7
***************
*** 60,64 ****
private short minorVersion_;
! private static final int MAGIC_NUMBER = 0xCAFEBABE;
/**
--- 60,64 ----
private short minorVersion_;
! private static final int MAGIC_NUMBER = 0xCAFEBABE;
/**
***************
*** 175,180 ****
for (int i = 0; i < entries.length; i++) {
ConstantPoolEntry entry = entries[i];
! if(entry instanceof CP_ClassEntry) {
! int index = ((CP_ClassEntry)entry).getIndex();
CP_Utf8Entry ue = (CP_Utf8Entry) constantPool.getEntryAt(index);
classDependencies_.addClass(ue.getValue());
--- 175,180 ----
for (int i = 0; i < entries.length; i++) {
ConstantPoolEntry entry = entries[i];
! if (entry instanceof CP_ClassEntry) {
! int index = ((CP_ClassEntry) entry).getIndex();
CP_Utf8Entry ue = (CP_Utf8Entry) constantPool.getEntryAt(index);
classDependencies_.addClass(ue.getValue());
***************
*** 219,228 ****
local_access_flags,
descriptorEntry.getValue());
for (int j = 0; j < attributes_count; j++) {
/*short attribute_name_index = */di.readShort();
int attribute_length = di.readInt();
! for (int k = 0; k < attribute_length; k++) {
! di.readByte();
! }
}
}
--- 219,235 ----
local_access_flags,
descriptorEntry.getValue());
+
+
for (int j = 0; j < attributes_count; j++) {
/*short attribute_name_index = */di.readShort();
int attribute_length = di.readInt();
! byte[] fieldAttribute = new byte[attribute_length];
! int bytesRead = 0;
! do {
! bytesRead += di.read(fieldAttribute,
! bytesRead,
! attribute_length - bytesRead);
!
! } while (bytesRead < attribute_length);
}
}
***************
*** 244,251 ****
/*short attribute_name_index2 = */di.readShort();
! int attribute_length2 = di.readInt();
! for (int k = 0; k < attribute_length2; k++) {
! /*byte info2 = */di.readByte();
! }
}
}
--- 251,263 ----
/*short attribute_name_index2 = */di.readShort();
! int attribute_length = di.readInt();
! byte[] fieldAttribute = new byte[attribute_length];
! int bytesRead = 0;
! do {
! bytesRead += di.read(fieldAttribute,
! bytesRead,
! attribute_length - bytesRead);
!
! } while (bytesRead < attribute_length);
}
}
|