src/main/java/com/aoindustries/io/buffer/SegmentedResult.java
private void writeSegment(int segmentIndex, Encoder encoder, Writer out) throws IOException {
		switch(segmentTypes[segmentIndex]) {
			case SegmentedWriter.TYPE_STRING :
				encoder.write(
					(String)segmentValues[segmentIndex],
					segmentOffsets[segmentIndex],
					segmentLengths[segmentIndex],
					out
				);
				break;
			case SegmentedWriter.TYPE_CHAR_NEWLINE :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('\n', out);
				break;
			case SegmentedWriter.TYPE_CHAR_QUOTE :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('"', out);
				break;
			case SegmentedWriter.TYPE_CHAR_APOS :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('\'', out);
				break;
			case SegmentedWriter.TYPE_CHAR_OTHER :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write((Character)segmentValues[segmentIndex], out);
				break;
			default :
				throw new AssertionError();
		}
	}
private void writeSegment(int segmentIndex, Encoder encoder, Writer out) throws IOException {
		switch(segmentTypes[segmentIndex]) {
			case SegmentedWriter.TYPE_STRING :
				encoder.write(
					(String)segmentValues[segmentIndex],
					segmentOffsets[segmentIndex],
					segmentLengths[segmentIndex],
					out
				);
				break;
			case SegmentedWriter.TYPE_CHAR_NEWLINE :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('\n', out);
				break;
			case SegmentedWriter.TYPE_CHAR_QUOTE :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('"', out);
				break;
			case SegmentedWriter.TYPE_CHAR_APOS :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write('\'', out);
				break;
			case SegmentedWriter.TYPE_CHAR_OTHER :
				assert segmentOffsets[segmentIndex]==0;
				assert segmentLengths[segmentIndex]==1;
				encoder.write((Character)segmentValues[segmentIndex], out);
				break;
			default :
				throw new AssertionError();
		}
	}
private void writeSegment ( int segmentIndex , Encoder encoder , Writer out ) throws IOException { switch ( segmentTypes [ segmentIndex ] ) { case SegmentedWriter . TYPE_STRING : encoder . write ( ( String ) segmentValues [ segmentIndex ] , segmentOffsets [ segmentIndex ] , segmentLengths [ segmentIndex ] , out ) ; break ; case SegmentedWriter . TYPE_CHAR_NEWLINE : assert segmentOffsets [ segmentIndex ] == 0 ; assert segmentLengths [ segmentIndex ] == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_QUOTE : assert segmentOffsets [ segmentIndex ] == 0 ; assert segmentLengths [ segmentIndex ] == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_APOS : assert segmentOffsets [ segmentIndex ] == 0 ; assert segmentLengths [ segmentIndex ] == 1 ; encoder . write ( ' ' , out ) ; break ; case SegmentedWriter . TYPE_CHAR_OTHER : assert segmentOffsets [ segmentIndex ] == 0 ; assert segmentLengths [ segmentIndex ] == 1 ; encoder . write ( ( Character ) segmentValues [ segmentIndex ] , out ) ; break ; default : throw new AssertionError ( ) ; } }
Writes the full segment (with original offset and length) to the given writer using the given encoder.
Writes the full segment ( with original offset and length ) to the given writer using the given encoder .