public void write(ByteCodeWriter out)
throws IOException
{
out.writeUTF8Const(getName());
TempStream ts = new TempStream();
ts.openWrite();
WriteStream ws = new WriteStream(ts);
ByteCodeWriter o2 = new ByteCodeWriter(ws, out.getJavaClass());
o2.writeShort(_maxStack);
o2.writeShort(_maxLocals);
o2.writeInt(_code.length);
o2.write(_code, 0, _code.length);
o2.writeShort(_exceptions.size());
for (int i = 0; i < _exceptions.size(); i++) {
ExceptionItem exn = _exceptions.get(i);
o2.writeShort(exn.getStart());
o2.writeShort(exn.getEnd());
o2.writeShort(exn.getHandler());
o2.writeShort(exn.getType());
}
o2.writeShort(_attributes.size());
for (int i = 0; i < _attributes.size(); i++) {
Attribute attr = _attributes.get(i);
attr.write(o2);
}
ws.close();
out.writeInt(ts.getLength());
TempBuffer ptr = ts.getHead();
for (; ptr != null; ptr = ptr.getNext())
out.write(ptr.getBuffer(), 0, ptr.getLength());
ts.destroy();
}