question: private ByteBuffer writeString ( CharsetEncoder encoder , String next , int i , int noOfValues ) throws CharacterCodingException { ByteBuffer bb ; if ( ( i + 1 ) == noOfValues ) { bb = encoder . encode ( CharBuffer . wrap ( next ) ) ; } else { if ( isNullSeperateMultipleValues ( ) ) { bb = encoder . encode ( CharBuffer . wrap ( next + '\0' ) ) ; } else { bb = encoder . encode ( CharBuffer . wrap ( next ) ) ; } } bb . rewind ( ) ; return bb ; }
target:  Write String using specified encoding When this is called multiple times, all but the last value has a trailing null