public void writeCoordinates(CoordinateSequence c, ContentHandler output) throws SAXException { String prefix = this.prefix + ":"; String namespaceUri = this.namespaceUri; if ( !namespaceAware ) { prefix = ""; namespaceUri = null; } output.startElement(namespaceUri, "coordinates", prefix + "coordinates", atts); final int coordCount = c.size(); //used to check whether the coordseq handles a third dimension or not final int coordSeqDimension = c.getDimension(); double x, y, z; //write down a coordinate at a time for (int i = 0, n = coordCount; i < n; i++) { x = c.getOrdinate(i, 0); y = c.getOrdinate(i, 1); // clear the buffer coordBuff.setLength(0); // format x into buffer and append delimiter coordFormatter.format(x,coordBuff,zero).append(coordinateDelimiter); // format y into buffer coordFormatter.format(y,coordBuff,zero); if (D == 3 || useDummyZ) { z = (D == 3 && coordSeqDimension > 2)? c.getOrdinate(i, 2) : dummyZ; coordBuff.append(coordinateDelimiter); coordFormatter.format(z, coordBuff, zero); } // if there is another coordinate, tack on a tuple delimiter if (i + 1 < coordCount){ coordBuff.append(tupleDelimiter); } // make sure our character buffer is big enough if (coordBuff.length() > buff.length) { buff = new char[coordBuff.length()]; } // copy the characters coordBuff.getChars(0, coordBuff.length(), buff, 0); // finally, output output.characters(buff, 0, coordBuff.length()); } output.endElement(namespaceUri,"coordinates", prefix + "coordinates"); }