Example #1
0
  /**
   * Queries a view as an {@link InputStream}
   *
   * <p>The stream should be properly closed after usage, as to avoid connection leaks.
   *
   * @return The result as an {@link InputStream}.
   */
  public InputStream queryForStream() {
    URI uri = uriBuilder.build();
    if (allDocsKeys != null) { // bulk docs
      return getStream(dbc.post(uri, allDocsKeys));
    }
    if (mapRedtempViewM != null) { // temp view
      return getStream(dbc.post(uri, gson.toJson(mapRedtempViewM)));
    }

    return dbc.get(uri);
  }