/** write a segment to an output stream. */ void write(java.io.Writer os, char encoding[]) throws Exception { os.write(name); Iterator it = fields.iterator(); // handling for msh - ignore the first two fields - but write the encoding characters directly if (name.equals("MSH")) { it.next(); it.next(); os.write(encoding); } while (it.hasNext()) { os.write(encoding[0]); Field fld = (Field) it.next(); if (fld != null) os.write(fld.encode(encoding)); } }