public static void encode ( final ChainedHttpConfig config , final ToServer ts ) { if ( handleRawUpload ( config , ts ) ) { return ; } final ChainedHttpConfig . ChainedRequest request = config . getChainedRequest ( ) ; final Csv . Context ctx = ( Csv . Context ) config . actualContext ( request . actualContentType ( ) , Csv . Context . ID ) ; final Object body = checkNull ( request . actualBody ( ) ) ; checkTypes ( body , new Class [ ] { Iterable . class } ) ; final StringWriter writer = new StringWriter ( ) ; final CSVWriter csvWriter = ctx . makeWriter ( new StringWriter ( ) ) ; Iterable < ? > iterable = ( Iterable < ? > ) body ; for ( Object o : iterable ) { csvWriter . writeNext ( ( String [ ] ) o ) ; } ts . toServer ( stringToStream ( writer . toString ( ) , request . actualCharset ( ) ) ) ; }
Used to encode the request content using the OpenCsv writer .