/** {@inheritDoc} */
  @Override
  public final Object read(final InputStream is) {
    final BAM result = new BAM();
    final EncogReadHelper in = new EncogReadHelper(is);
    EncogFileSection section;

    while ((section = in.readNextSection()) != null) {
      if (section.getSectionName().equals("BAM") && section.getSubSectionName().equals("PARAMS")) {
        final Map<String, String> params = section.parseParams();
        result.getProperties().putAll(params);
      }
      if (section.getSectionName().equals("BAM") && section.getSubSectionName().equals("NETWORK")) {
        final Map<String, String> params = section.parseParams();

        result.setF1Count(EncogFileSection.parseInt(params, PersistConst.PROPERTY_F1_COUNT));
        result.setF2Count(EncogFileSection.parseInt(params, PersistConst.PROPERTY_F2_COUNT));
        result.setWeightsF1toF2(
            EncogFileSection.parseMatrix(params, PersistConst.PROPERTY_WEIGHTS_F1_F2));
        result.setWeightsF2toF1(
            EncogFileSection.parseMatrix(params, PersistConst.PROPERTY_WEIGHTS_F2_F1));
      }
    }

    return result;
  }