public void write(DataOutputStream out) throws IOException, jasError {
  out.writeInt(magic);
  out.writeShort(version_lo);
  out.writeShort(version_hi);
  int curidx=1;
  cpe_index=new Hashtable();
  for (Enumeration e=cpe.elements(); e.hasMoreElements(); ) {
    CP tmp=(CP)(e.nextElement());
    cpe_index.put(tmp.getUniq(),new Integer(curidx));
    curidx++;
    if ((tmp instanceof LongCP) || (tmp instanceof DoubleCP))     curidx++;
  }
  out.writeShort((short)curidx);
  for (Enumeration e=cpe.elements(); e.hasMoreElements(); ) {
    CP now=(CP)(e.nextElement());
    now.write(this,out);
  }
  out.writeShort(class_access);
  out.writeShort(getCPIndex(this_class));
  out.writeShort(getCPIndex(super_class));
  out.writeShort(interfaces.size());
  for (Enumeration e=interfaces.elements(); e.hasMoreElements(); ) {
    CP c=(CP)(e.nextElement());
    out.writeShort(getCPIndex(c));
  }
  out.writeShort(vars.size());
  for (Enumeration e=vars.elements(); e.hasMoreElements(); ) {
    Var v=(Var)(e.nextElement());
    v.write(this,out);
  }
  out.writeShort(methods.size());
  for (Enumeration e=methods.elements(); e.hasMoreElements(); ) {
    Method m=(Method)(e.nextElement());
    m.write(this,out);
  }
  short numExtra=0;
  if (source != null) {
    numExtra++;
  }
  if (debug != null) {
    numExtra++;
  }
  if (enclosing != null) {
    numExtra++;
  }
  if (signature != null) {
    numExtra++;
  }
  if (innerclasses != null) {
    numExtra++;
  }
  if (depr != null) {
    numExtra++;
  }
  if (annVis != null) {
    numExtra++;
  }
  if (annInvis != null) {
    numExtra++;
  }
  numExtra+=generic.size();
  out.writeShort(numExtra);
  if (source != null) {
    source.write(this,out);
  }
  if (debug != null) {
    debug.write(this,out);
  }
  if (enclosing != null) {
    enclosing.write(this,out);
  }
  if (signature != null) {
    signature.write(this,out);
  }
  if (innerclasses != null) {
    innerclasses.write(this,out);
  }
  if (depr != null) {
    depr.write(this,out);
  }
  if (annVis != null) {
    annVis.write(this,out);
  }
  if (annInvis != null) {
    annInvis.write(this,out);
  }
  for (Enumeration gen=generic.elements(); gen.hasMoreElements(); ) {
    GenericAttr gattr=(GenericAttr)gen.nextElement();
    gattr.write(this,out);
  }
  out.flush();
}

public void write ( DataOutputStream out ) throws IOException , jasError { out . writeInt ( magic ) ; out . writeShort ( version_lo ) ; out . writeShort ( version_hi ) ; int curidx = 1 ; cpe_index = new Hashtable ( ) ; for ( Enumeration e = cpe . elements ( ) ; e . hasMoreElements ( ) ; ) { CP tmp = ( CP ) ( e . nextElement ( ) ) ; cpe_index . put ( tmp . getUniq ( ) , new Integer ( curidx ) ) ; curidx ++ ; if ( ( tmp instanceof LongCP ) || ( tmp instanceof DoubleCP ) ) curidx ++ ; } out . writeShort ( ( short ) curidx ) ; for ( Enumeration e = cpe . elements ( ) ; e . hasMoreElements ( ) ; ) { CP now = ( CP ) ( e . nextElement ( ) ) ; now . write ( this , out ) ; } out . writeShort ( class_access ) ; out . writeShort ( getCPIndex ( this_class ) ) ; out . writeShort ( getCPIndex ( super_class ) ) ; out . writeShort ( interfaces . size ( ) ) ; for ( Enumeration e = interfaces . elements ( ) ; e . hasMoreElements ( ) ; ) { CP c = ( CP ) ( e . nextElement ( ) ) ; out . writeShort ( getCPIndex ( c ) ) ; } out . writeShort ( vars . size ( ) ) ; for ( Enumeration e = vars . elements ( ) ; e . hasMoreElements ( ) ; ) { Var v = ( Var ) ( e . nextElement ( ) ) ; v . write ( this , out ) ; } out . writeShort ( methods . size ( ) ) ; for ( Enumeration e = methods . elements ( ) ; e . hasMoreElements ( ) ; ) { Method m = ( Method ) ( e . nextElement ( ) ) ; m . write ( this , out ) ; } short numExtra = 0 ; if ( source != null ) { numExtra ++ ; } if ( debug != null ) { numExtra ++ ; } if ( enclosing != null ) { numExtra ++ ; } if ( signature != null ) { numExtra ++ ; } if ( innerclasses != null ) { numExtra ++ ; } if ( depr != null ) { numExtra ++ ; } if ( annVis != null ) { numExtra ++ ; } if ( annInvis != null ) { numExtra ++ ; } numExtra += generic . size ( ) ; out . writeShort ( numExtra ) ; if ( source != null ) { source . write ( this , out ) ; } if ( debug != null ) { debug . write ( this , out ) ; } if ( enclosing != null ) { enclosing . write ( this , out ) ; } if ( signature != null ) { signature . write ( this , out ) ; } if ( innerclasses != null ) { innerclasses . write ( this , out ) ; } if ( depr != null ) { depr . write ( this , out ) ; } if ( annVis != null ) { annVis . write ( this , out ) ; } if ( annInvis != null ) { annInvis . write ( this , out ) ; } for ( Enumeration gen = generic . elements ( ) ; gen . hasMoreElements ( ) ; ) { GenericAttr gattr = ( GenericAttr ) gen . nextElement ( ) ; gattr . write ( this , out ) ; } out . flush ( ) ; }
write the contents of the class .
