code: public static byte[] readStream(InputStream inputStream) throws IOException
      {
          //create output stream
          ByteArrayOutputStream outputStream=new ByteArrayOutputStream(5000);
          
          //read/write
          IOHelper.readAndWriteStreams(inputStream,outputStream);
          
          //get data
          byte[] data=outputStream.toByteArray();
  
          return data;
      }
docs: Reads the data from the stream.
  
  @param   inputStream
  The inputStream
  @return  The data read from the provided stream
  @throws  IOException
  Any IO exception