com.netease.cloud.services.nos.model
public class NOSObjectInputStream extends FilterInputStream
NOSObject
. In addition to
the methods supplied by the InputStream
class,
NOSObjectInputStream
supplies the abort() method, which will
terminate an HTTP connection to the Nos object.in
Constructor and Description |
---|
NOSObjectInputStream(InputStream in,
org.apache.http.client.methods.HttpRequestBase httpRequest) |
Modifier and Type | Method and Description |
---|---|
void |
abort()
Aborts the underlying http request without reading any more data and
closes the stream.
|
org.apache.http.client.methods.HttpRequestBase |
getHttpRequest()
Returns the http request from which this input stream is derived.
|
available, close, mark, markSupported, read, read, read, reset, skip
public NOSObjectInputStream(InputStream in, org.apache.http.client.methods.HttpRequestBase httpRequest)
public void abort() throws IOException
By default Apache HttpClient
tries to reuse http connections by
reading to the end of an attached input stream on
InputStream.close()
. This is efficient from a socket pool
management perspective, but for objects with large payloads can incur
significant overhead while bytes are read from Nos and discarded. It's up
to clients to decide when to take the performance hit implicit in not
reusing an http connection in order to not read unnecessary information
from Nos.
IOException
EofSensorInputStream
public org.apache.http.client.methods.HttpRequestBase getHttpRequest()
Copyright © 2017. All Rights Reserved.