private void bufferContent(){
  if (buffer != null) {
    return;
  }
  if (content != null) {
    try {
      final ByteArrayOutputStream tmp=new ByteArrayOutputStream();
      final byte[] data=new byte[4096];
      int l=0;
      while ((l=content.read(data)) >= 0) {
        tmp.write(data,0,l);
      }
      buffer=tmp.toByteArray();
      content=null;
      contentLength=buffer.length;
    }
 catch (    final IOException e) {
      LOG.error(e.getMessage(),e);
      buffer=null;
      content=null;
      contentLength=0;
    }
  }
}

private void bufferContent ( ) { if ( buffer != null ) { return ; } if ( content != null ) { try { final ByteArrayOutputStream tmp = new ByteArrayOutputStream ( ) ; final byte [ ] data = new byte [ 4096 ] ; int l = 0 ; while ( ( l = content . read ( data ) ) >= 0 ) { tmp . write ( data , 0 , l ) ; } buffer = tmp . toByteArray ( ) ; content = null ; contentLength = buffer . length ; } catch ( final IOException e ) { LOG . error ( e . getMessage ( ) , e ) ; buffer = null ; content = null ; contentLength = 0 ; } } }
buffers request body input stream .
