public void write(DataOutputStream out) throws IOException {
  int i, n;
  out.writeInt(0xCAFEBABE);
  out.writeShort(minor);
  out.writeShort(major);
  constPool.write(out);
  out.writeShort(accessFlags);
  out.writeShort(thisClass);
  out.writeShort(superClass);
  if (interfaces == null)   n=0;
 else   n=interfaces.length;
  out.writeShort(n);
  for (i=0; i < n; ++i)   out.writeShort(interfaces[i]);
  ArrayList list=fields;
  n=list.size();
  out.writeShort(n);
  for (i=0; i < n; ++i) {
    FieldInfo finfo=(FieldInfo)list.get(i);
    finfo.write(out);
  }
  list=methods;
  n=list.size();
  out.writeShort(n);
  for (i=0; i < n; ++i) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    minfo.write(out);
  }
  out.writeShort(attributes.size());
  AttributeInfo.writeAll(attributes,out);
}

public void write ( DataOutputStream out ) throws IOException { int i , n ; out . writeInt ( 0xCAFEBABE ) ; out . writeShort ( minor ) ; out . writeShort ( major ) ; constPool . write ( out ) ; out . writeShort ( accessFlags ) ; out . writeShort ( thisClass ) ; out . writeShort ( superClass ) ; if ( interfaces == null ) n = 0 ; else n = interfaces . length ; out . writeShort ( n ) ; for ( i = 0 ; i < n ; ++ i ) out . writeShort ( interfaces [ i ] ) ; ArrayList list = fields ; n = list . size ( ) ; out . writeShort ( n ) ; for ( i = 0 ; i < n ; ++ i ) { FieldInfo finfo = ( FieldInfo ) list . get ( i ) ; finfo . write ( out ) ; } list = methods ; n = list . size ( ) ; out . writeShort ( n ) ; for ( i = 0 ; i < n ; ++ i ) { MethodInfo minfo = ( MethodInfo ) list . get ( i ) ; minfo . write ( out ) ; } out . writeShort ( attributes . size ( ) ) ; AttributeInfo . writeAll ( attributes , out ) ; }
writes a class file represented by this object into an output stream .
