< prev index next >
src/java.base/share/classes/jdk/internal/jimage/UTF8String.java
Print this page
@@ -256,14 +256,14 @@
}
}
@Override
public String toString() {
- ByteBuffer buffer = ByteBuffer.allocate(bytes.length+2);
+ ByteBuffer buffer = ByteBuffer.allocate(count+2);
buffer.order(ByteOrder.BIG_ENDIAN);
- buffer.putShort((short)bytes.length);
- buffer.put(bytes);
+ buffer.putShort((short)count);
+ buffer.put(bytes, offset, count);
ByteArrayInputStream stream = new ByteArrayInputStream(buffer.array());
DataInputStream in = new DataInputStream(stream);
try {
return in.readUTF();
} catch (IOException ex) {
< prev index next >