public void writeBinaryTo(DataOutput out) throws IOException {
  out.writeInt(numByteFeatures);
  for (int i=0; i < numByteFeatures; i++) {
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
    }
 else {
      out.writeFloat(0);
    }
    out.writeUTF(getFeatureName(i));
    int numValues=getNumberOfValues(i);
    byte numValuesEncoded=(byte)numValues;
    out.writeByte(numValuesEncoded);
    for (int b=0; b < numValues; b++) {
      String value=getFeatureValueAsString(i,b);
      out.writeUTF(value);
    }
  }
  out.writeInt(numShortFeatures);
  for (int i=numByteFeatures; i < numByteFeatures + numShortFeatures; i++) {
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
    }
 else {
      out.writeFloat(0);
    }
    out.writeUTF(getFeatureName(i));
    short numValues=(short)getNumberOfValues(i);
    out.writeShort(numValues);
    for (short b=0; b < numValues; b++) {
      String value=getFeatureValueAsString(i,b);
      out.writeUTF(value);
    }
  }
  out.writeInt(numContinuousFeatures);
  for (int i=numByteFeatures + numShortFeatures; i < numByteFeatures + numShortFeatures + numContinuousFeatures; i++) {
    if (featureWeights != null) {
      out.writeFloat(featureWeights[i]);
      out.writeUTF(floatWeightFuncts[i - numByteFeatures - numShortFeatures]);
    }
 else {
      out.writeFloat(0);
      out.writeUTF("");
    }
    out.writeUTF(getFeatureName(i));
  }
}

public void writeBinaryTo ( DataOutput out ) throws IOException { out . writeInt ( numByteFeatures ) ; for ( int i = 0 ; i < numByteFeatures ; i ++ ) { if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; } else { out . writeFloat ( 0 ) ; } out . writeUTF ( getFeatureName ( i ) ) ; int numValues = getNumberOfValues ( i ) ; byte numValuesEncoded = ( byte ) numValues ; out . writeByte ( numValuesEncoded ) ; for ( int b = 0 ; b < numValues ; b ++ ) { String value = getFeatureValueAsString ( i , b ) ; out . writeUTF ( value ) ; } } out . writeInt ( numShortFeatures ) ; for ( int i = numByteFeatures ; i < numByteFeatures + numShortFeatures ; i ++ ) { if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; } else { out . writeFloat ( 0 ) ; } out . writeUTF ( getFeatureName ( i ) ) ; short numValues = ( short ) getNumberOfValues ( i ) ; out . writeShort ( numValues ) ; for ( short b = 0 ; b < numValues ; b ++ ) { String value = getFeatureValueAsString ( i , b ) ; out . writeUTF ( value ) ; } } out . writeInt ( numContinuousFeatures ) ; for ( int i = numByteFeatures + numShortFeatures ; i < numByteFeatures + numShortFeatures + numContinuousFeatures ; i ++ ) { if ( featureWeights != null ) { out . writeFloat ( featureWeights [ i ] ) ; out . writeUTF ( floatWeightFuncts [ i - numByteFeatures - numShortFeatures ] ) ; } else { out . writeFloat ( 0 ) ; out . writeUTF ( "" ) ; } out . writeUTF ( getFeatureName ( i ) ) ; } }
write this feature definition in binary format to the given output .
