code: public static StaticBody fromStream(
              final InputStream inStream)
              throws BOSHException {
          ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
          try {
              byte[] buffer = new byte[BUFFER_SIZE];
              int read;
              do {
                  read = inStream.read(buffer);
                  if (read > 0) {
                      byteOut.write(buffer, 0, read);
                  }
              } while (read >= 0);
          } catch (IOException iox) {
              throw(new BOSHException(
                      "Could not read body data", iox));
          }
          return fromString(byteOut.toString());
      }
docs: Creates an instance which is initialized by reading a body
  message from the provided stream.
  
  @param inStream stream to read message XML from
  @return body instance
  @throws BOSHException on parse error