Package org.apache.solr.client.solrj

## Class InputStreamResponse

- java.lang.Object
- - org.apache.solr.client.solrj.SolrResponse
  - - org.apache.solr.client.solrj.response.SimpleSolrResponse
    - - org.apache.solr.client.solrj.InputStreamResponse

All Implemented Interfaces:
  `Serializable`, `MapSerializable`, `MapWriter`, `NavigableObject`, `org.noggit.JSONWriter.Writable`

Direct Known Subclasses:
  `FileStoreApi.GetFileResponse`, `ReplicationApi.FetchFile1Response`, `ZookeeperReadApi.ReadNodeResponse`

    public class InputStreamResponse
    extends SimpleSolrResponse

Represents the NamedList response format created by `InputStreamResponseParser`.

Particularly useful when targeting APIs that return arbitrary or binary data (e.g. replication APIs for fetching index files)

See Also:
  Serialized Form

### Nested Class Summary

### Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter

`MapWriter.EntryWriter`

### Field Summary

Fields
`static Function<Integer,​Boolean>` `HTTP_OK_VALIDATOR`
`static Function<Integer,​Boolean>` `NON_ERROR_CODE_VALIDATOR`

### Fields inherited from class org.apache.solr.client.solrj.response.SimpleSolrResponse

`elapsedTime, nl`

### Fields inherited from interface org.apache.solr.common.MapWriter

`EMPTY`

### Constructor Summary

Constructors
`InputStreamResponse()`

### Method Summary

All Methods Instance Methods Concrete Methods
`int` `getHttpStatus()`
`InputStream` `getResponseStream()` Access the server response as an `InputStream`, regardless of the HTTP status code
`InputStream` `getResponseStreamIfSuccessful()` Access the server response as an `InputStream`, after ensuring that the HTTP status code is 200 ('OK')
`InputStream` `getResponseStreamIfSuccessful​(Function<Integer,​Boolean> statusValidator)` Access the server response as an `InputStream`, after ensuring the HTTP status code passes a provided validator.
`void` `setResponse​(NamedList<Object> rsp)`

### Methods inherited from class org.apache.solr.client.solrj.response.SimpleSolrResponse

`getElapsedTime, getResponse, setElapsedTime`

### Methods inherited from class org.apache.solr.client.solrj.SolrResponse

`getException, writeMap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface org.apache.solr.common.MapWriter

`append, jsonStr, toMap, write`

### Methods inherited from interface org.apache.solr.common.NavigableObject

`_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _get, _getStr, _getStr, _getStr, _size`

### Field Detail

#### HTTP_OK_VALIDATOR

    public static final Function<Integer,​Boolean> HTTP_OK_VALIDATOR

#### NON_ERROR_CODE_VALIDATOR

    public static final Function<Integer,​Boolean> NON_ERROR_CODE_VALIDATOR

### Constructor Detail

#### InputStreamResponse

    public InputStreamResponse()

### Method Detail

#### setResponse

    public void setResponse​(NamedList<Object> rsp)

Overrides:
  `setResponse` in class `SimpleSolrResponse`

#### getHttpStatus

    public int getHttpStatus()

#### getResponseStream

    public InputStream getResponseStream()

Access the server response as an `InputStream`, regardless of the HTTP status code

Caller is responsible for consuming and closing the stream. No validation is done on the HTTP status code.

#### getResponseStreamIfSuccessful

    public InputStream getResponseStreamIfSuccessful()

Access the server response as an `InputStream`, after ensuring that the HTTP status code is 200 ('OK')

Caller is responsible for consuming and closing the stream, and releasing it from the tracking done by `ObjectReleaseTracker`.

#### getResponseStreamIfSuccessful

    public InputStream getResponseStreamIfSuccessful​(Function<Integer,​Boolean> statusValidator)

Access the server response as an `InputStream`, after ensuring the HTTP status code passes a provided validator.

Parameters:
  `statusValidator` - a function that returns true iff the response body should be returned