private void writeSegment ( int segmentIndex , int off , int len , Encoder encoder , Writer out ) throws IOException { switch ( segmentTypes [ segmentIndex ] ) { case SegmentedWriter . TYPE_STRING : encoder . write ( ( String ) segmentValues [ segmentIndex ] , off , len , out ) ; break ; case SegmentedWriter . TYPE_CHAR_NEWLINE : assert off == 0 ; assert len == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_QUOTE : assert off == 0 ; assert len == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_APOS : assert off == 0 ; assert len == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_OTHER : assert off == 0 ; assert len == 1 ; encoder . write ( ( Character ) segmentValues [ segmentIndex ] , out ) ; break ; default : throw new AssertionError ( ) ; } }
Writes the given range of a segment to the given writer using the given encoder .