本文整理了Java中okhttp3.internal.Util.discard()
方法的一些代码示例,展示了Util.discard()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.discard()
方法的具体详情如下:
包路径:okhttp3.internal.Util
类名称:Util
方法名:discard
[英]Attempts to exhaust source, returning true if successful. This is useful when reading a complete source is helpful, such as when doing so completes a cache body or frees a socket connection for reuse.
[中]尝试耗尽源,如果成功,则返回true。当读取完整的源代码时,这很有用,例如这样做可以完成缓存体或释放套接字连接以供重用。
代码示例来源:origin: square/okhttp
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0 && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: square/okhttp
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: square/okhttp
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpCodec.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: com.squareup.okhttp3/okhttp
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0 && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: com.squareup.okhttp3/okhttp
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpCodec.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: apollographql/apollo-android
@Override public void close() throws IOException {
if (closed) return;
closed = true;
if (discard(this, HttpCodec.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
responseBodySource.close();
commitCache();
} else {
responseBodySource.close();
abortCacheQuietly();
}
}
代码示例来源:origin: huxq17/SwipeCardsView
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
unexpectedEndOfInput();
}
closed = true;
}
}
代码示例来源:origin: duzechao/OKHttpUtils
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0 && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false);
}
closed = true;
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: duzechao/OKHttpUtils
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false);
}
closed = true;
}
}
代码示例来源:origin: huxq17/tractor
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0
&& !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
unexpectedEndOfInput();
}
closed = true;
}
}
代码示例来源:origin: huxq17/SwipeCardsView
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0
&& !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
unexpectedEndOfInput();
}
closed = true;
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override public void close() throws IOException {
if (closed) return;
if (bytesRemaining != 0 && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: com.github.ljun20160606/okhttp
@Override public void close() throws IOException {
if (closed) return;
if (hasMoreChunks && !Util.discard(this, DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
endOfInput(false, null);
}
closed = true;
}
}
代码示例来源:origin: huxq17/SwipeCardsView
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpStream.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: huxq17/tractor
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpStream.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: apache/servicemix-bundles
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpCodec.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: duzechao/OKHttpUtils
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpStream.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
代码示例来源:origin: com.github.ljun20160606/okhttp
@Override public void close() throws IOException {
if (!cacheRequestClosed
&& !discard(this, HttpCodec.DISCARD_STREAM_TIMEOUT_MILLIS, MILLISECONDS)) {
cacheRequestClosed = true;
cacheRequest.abort();
}
source.close();
}
};
内容来源于网络,如有侵权,请联系作者删除!