private HttpEntity populateEntity ( RequestElements intuitRequest ) throws FMSException { byte [ ] compressedData = intuitRequest . getCompressedData ( ) ; if ( null == compressedData ) { // use postString to create httpEntity try { return new StringEntity ( intuitRequest . getPostString ( ) ) ; } catch ( UnsupportedEncodingException e ) { throw new FMSException ( "UnsupportedEncodingException" , e ) ; } } // use compressed data to create httpEntity return new InputStreamEntity ( new ByteArrayInputStream ( compressedData ) , compressedData . length ) ; }
Creates HttpEntity depends from type of content