public int writeProfile(ProfileFeature profile) throws IOException { profile.resetIteration(); int count = 0; while (profile.hasNext()) { PointFeature pf = profile.next(); if (!headerDone) { if (id_strlen == 0) id_strlen = profile.getName().length() * 2; writeHeader(profile, pf); headerDone = true; } writeObsData(pf); count++; } writeProfileData(profile, count); return count; }