From ce0ff81ae97f1503f83255eeaba5f3951df379e2 Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 9 Feb 1999 18:04:26 +0000 Subject: [PATCH] count field added git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@249 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/bytecode/ConstantPool.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/jode/jode/bytecode/ConstantPool.java b/jode/jode/bytecode/ConstantPool.java index 0ea1377..85c0ced 100644 --- a/jode/jode/bytecode/ConstantPool.java +++ b/jode/jode/bytecode/ConstantPool.java @@ -38,6 +38,7 @@ public class ConstantPool { public final static int NAMEANDTYPE = 12; public final static int UTF8 = 1; + int count; int[] tags; int[] indices1, indices2; @@ -48,7 +49,7 @@ public class ConstantPool { public void read(DataInputStream stream) throws IOException { - int count = stream.readUnsignedShort(); + count = stream.readUnsignedShort(); tags = new int[count]; indices1 = new int[count]; indices2 = new int[count]; @@ -89,7 +90,7 @@ public class ConstantPool { indices2[i] = stream.readUnsignedShort(); break; case UTF8: - constants[i] = new String(stream.readUTF()); + constants[i] = stream.readUTF(); break; default: throw new ClassFormatException("unknown constant tag"); @@ -239,9 +240,13 @@ public class ConstantPool { } } + public int size() { + return count; + } + public String toString() { StringBuffer result = new StringBuffer("[ null"); - for (int i=1; i< tags.length; i++) { + for (int i=1; i< count; i++) { result.append(", ").append(toString(i)); } result.append(" ]");