public byte [ ] asByteArray ( ) throws IOException { if ( reader != null ) { throw new IllegalStateException ( "Cannot get raw bytes from a Reader object." ) ; } InputStream in = buildInputStream ( ) ; return consumeInputStream ( in ) ; }
Gets the stream contents as a byte array .