@SuppressWarnings("nls") protected void writePath(Shape s){
  PathIterator segments=s.getPathIterator(null);
  double[] coords=new double[6];
  for (int i=0; !segments.isDone(); i++, segments.next()) {
    if (i > 0) {
      write(" ");
    }
    int segmentType=segments.currentSegment(coords);
switch (segmentType) {
case PathIterator.SEG_MOVETO:
      write("M",coords[0],",",coords[1]);
    break;
case PathIterator.SEG_LINETO:
  write("L",coords[0],",",coords[1]);
break;
case PathIterator.SEG_CUBICTO:
write("C",coords[0],",",coords[1]," ",coords[2],",",coords[3]," ",coords[4],",",coords[5]);
break;
case PathIterator.SEG_QUADTO:
write("Q",coords[0],",",coords[1]," ",coords[2],",",coords[3]);
break;
case PathIterator.SEG_CLOSE:
write("Z");
break;
default :
throw new IllegalStateException("Unknown path operation.");
}
}
}

@ SuppressWarnings ( "nls" ) protected void writePath ( Shape s ) { PathIterator segments = s . getPathIterator ( null ) ; double [ ] coords = new double [ 6 ] ; for ( int i = 0 ; ! segments . isDone ( ) ; i ++ , segments . next ( ) ) { if ( i > 0 ) { write ( " " ) ; } int segmentType = segments . currentSegment ( coords ) ; switch ( segmentType ) { case PathIterator . SEG_MOVETO : write ( "M" , coords [ 0 ] , "," , coords [ 1 ] ) ; break ; case PathIterator . SEG_LINETO : write ( "L" , coords [ 0 ] , "," , coords [ 1 ] ) ; break ; case PathIterator . SEG_CUBICTO : write ( "C" , coords [ 0 ] , "," , coords [ 1 ] , " " , coords [ 2 ] , "," , coords [ 3 ] , " " , coords [ 4 ] , "," , coords [ 5 ] ) ; break ; case PathIterator . SEG_QUADTO : write ( "Q" , coords [ 0 ] , "," , coords [ 1 ] , " " , coords [ 2 ] , "," , coords [ 3 ] ) ; break ; case PathIterator . SEG_CLOSE : write ( "Z" ) ; break ; default : throw new IllegalStateException ( "Unknown path operation." ) ; } } }
writes the beginning of the specified shape without any closing commands .
