float[] coordinates = new float[6];
// iteratively write isDone, segment type and segment coordinates
boolean isDone = pathIterator.isDone();
while (!isDone){
int segmentType = pathIterator.currentSegment(coordinates);
out.writeBoolean(isDone);
out.writeInt(segmentType);
for (int i = 0; i < 6; i++)
out.writeFloat(coordinates[i]) ;
pathIterator.next();