@ Override public void write ( OutputStream output ) throws IOException , WebApplicationException { //Write until available bytes are less than buffer. while ( bufferedInputStream . available ( ) > buffer . length ) { bufferedInputStream . read ( buffer ) ; output . write ( buffer ) ; } //Write one more time to finish and exit. buffer = new byte [ bufferedInputStream . available ( ) ] ; bufferedInputStream . read ( buffer ) ; output . write ( buffer ) ; bufferedInputStream . close ( ) ; }
Called to write the message body .