Fix in JavaClassReader>>skipAttribute:
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 26 Nov 2014 16:45:58 +0000
changeset 3279 3188fcb8391d
parent 3278 c56b4d5f0c52
child 3281 d95fd165e9e3
child 3288 90f0566d8145
Fix in JavaClassReader>>skipAttribute: ...do not actually read the contents, skip it (by means Stream>>skip:). This saves creation of a ByteArray and data copying.
JavaClassReader.st
--- a/JavaClassReader.st	Sun Nov 23 18:45:01 2014 +0000
+++ b/JavaClassReader.st	Wed Nov 26 16:45:58 2014 +0000
@@ -132,6 +132,7 @@
     "Created: 3.8.1997 / 18:17:21 / cg"
 ! !
 
+
 !JavaClassReader class methodsFor:'constants'!
 
 fileMajorVersions
@@ -1309,16 +1310,14 @@
 skipAttribute:attributeName
     "dont know about this attribute - skip it here"
 
-    |attribute_length attribute_info|
+    |attribute_length|
 
     attribute_length := inStream nextUnsignedLongMSB:msb.
-    attribute_info := ByteArray new:(attribute_length).
-    inStream nextBytes:attribute_length into:attribute_info startingAt:1.
-    attribute_info.
+    inStream skip: attribute_length.
     Verbose ifTrue:[Transcript show:'skipped '; show:attributeName; showCR:'-attribute'].
 
     "Created: / 09-04-1998 / 18:12:46 / cg"
-    "Modified: / 16-10-2013 / 01:54:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-11-2014 / 16:38:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaClassReader methodsFor:'file reading - attributes-ST'!