Exemple #1
0
  public void write(DataOutputStream stream) throws IOException {
    byte[] bytes = this.stream.toByteArray();

    fixLabels(bytes);

    int n = exceptions.size();
    int length = bytes.length + 12 + 8 * n;
    ;
    if (linenumbers != null) length += linenumbers.length();
    stream.writeShort(att_name);
    stream.writeInt(length);
    stream.writeShort(max_stack);
    stream.writeShort(nlocals);
    stream.writeInt(bytes.length);
    stream.write(bytes);

    // No Exceptions for now
    stream.writeShort(n);
    for (int i = 0; i < n; i++) {
      ExceptionLabel e = (ExceptionLabel) exceptions.elementAt(i);
      stream.writeShort(e.start.getPosition());
      stream.writeShort(e.end.getPosition());
      stream.writeShort(e.handler.getPosition());
      stream.writeShort(e.exc);
    }
    if (linenumbers != null) ClassFile.writeAttributes(stream, new Attribute[] {linenumbers});
    else ClassFile.writeAttributes(stream, new Attribute[0]);
  }
Exemple #2
0
 public void setline(int line) throws IOException {
   if (linenumbers == null) linenumbers = new LineNumberTable(pool);
   linenumbers.addLine(size(), line);
 }