public void writeTo(DataOutput out) throws IOException {
  out.writeInt(typeId);
  U.writeString(out,typeName);
  if (fields == null)   out.writeInt(-1);
 else {
    out.writeInt(fields.size());
    for (    Map.Entry<String,Integer> fieldEntry : fields.entrySet()) {
      U.writeString(out,fieldEntry.getKey());
      out.writeInt(fieldEntry.getValue());
    }
  }
  U.writeString(out,affKeyFieldName);
  if (schemas == null)   out.writeInt(-1);
 else {
    out.writeInt(schemas.size());
    for (    BinarySchema schema : schemas)     schema.writeTo(out);
  }
  out.writeBoolean(isEnum);
}

public void writeTo ( DataOutput out ) throws IOException { out . writeInt ( typeId ) ; U . writeString ( out , typeName ) ; if ( fields == null ) out . writeInt ( - 1 ) ; else { out . writeInt ( fields . size ( ) ) ; for ( Map . Entry < String , Integer > fieldEntry : fields . entrySet ( ) ) { U . writeString ( out , fieldEntry . getKey ( ) ) ; out . writeInt ( fieldEntry . getValue ( ) ) ; } } U . writeString ( out , affKeyFieldName ) ; if ( schemas == null ) out . writeInt ( - 1 ) ; else { out . writeInt ( schemas . size ( ) ) ; for ( BinarySchema schema : schemas ) schema . writeTo ( out ) ; } out . writeBoolean ( isEnum ) ; }
the object implements the writeto method to save its contents by calling the methods of dataoutput for its primitive values and strings or calling the writeto method for other objects .
