public void readFrom(DataInput in) throws IOException {
  typeId=in.readInt();
  typeName=U.readString(in);
  int fieldsSize=in.readInt();
  if (fieldsSize == -1)   fields=null;
 else {
    fields=new HashMap<>();
    for (int i=0; i < fieldsSize; i++) {
      String fieldName=U.readString(in);
      int fieldId=in.readInt();
      fields.put(fieldName,fieldId);
    }
  }
  affKeyFieldName=U.readString(in);
  int schemasSize=in.readInt();
  if (schemasSize == -1)   schemas=null;
 else {
    schemas=new ArrayList<>();
    for (int i=0; i < schemasSize; i++) {
      BinarySchema schema=new BinarySchema();
      schema.readFrom(in);
      schemas.add(schema);
    }
  }
  isEnum=in.readBoolean();
}

public void readFrom ( DataInput in ) throws IOException { typeId = in . readInt ( ) ; typeName = U . readString ( in ) ; int fieldsSize = in . readInt ( ) ; if ( fieldsSize == - 1 ) fields = null ; else { fields = new HashMap < > ( ) ; for ( int i = 0 ; i < fieldsSize ; i ++ ) { String fieldName = U . readString ( in ) ; int fieldId = in . readInt ( ) ; fields . put ( fieldName , fieldId ) ; } } affKeyFieldName = U . readString ( in ) ; int schemasSize = in . readInt ( ) ; if ( schemasSize == - 1 ) schemas = null ; else { schemas = new ArrayList < > ( ) ; for ( int i = 0 ; i < schemasSize ; i ++ ) { BinarySchema schema = new BinarySchema ( ) ; schema . readFrom ( in ) ; schemas . add ( schema ) ; } } isEnum = in . readBoolean ( ) ; }
the object implements the readfrom method to restore its contents by calling the methods of datainput for primitive types and strings or calling readexternal for other objects . the readfrom method must read the values in the same sequence and with the same types as were written by writeto .
