本文整理汇总了Java中org.apache.http.util.Args.positive方法的典型用法代码示例。如果您正苦于以下问题:Java Args.positive方法的具体用法?Java Args.positive怎么用?Java Args.positive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.http.util.Args
的用法示例。
在下文中一共展示了Args.positive方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: BHttpConnectionBase
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Creates new instance of BHttpConnectionBase.
*
* @param buffersize buffer size. Must be a positive number.
* @param fragmentSizeHint fragment size hint.
* @param chardecoder decoder to be used for decoding HTTP protocol elements.
* If <code>null</code> simple type cast will be used for byte to char conversion.
* @param charencoder encoder to be used for encoding HTTP protocol elements.
* If <code>null</code> simple type cast will be used for char to byte conversion.
* @param constraints Message constraints. If <code>null</code>
* {@link MessageConstraints#DEFAULT} will be used.
* @param incomingContentStrategy incoming content length strategy. If <code>null</code>
* {@link LaxContentLengthStrategyHC4#INSTANCE} will be used.
* @param outgoingContentStrategy outgoing content length strategy. If <code>null</code>
* {@link StrictContentLengthStrategyHC4#INSTANCE} will be used.
*/
protected BHttpConnectionBase(
final int buffersize,
final int fragmentSizeHint,
final CharsetDecoder chardecoder,
final CharsetEncoder charencoder,
final MessageConstraints constraints,
final ContentLengthStrategy incomingContentStrategy,
final ContentLengthStrategy outgoingContentStrategy) {
super();
Args.positive(buffersize, "Buffer size");
final HttpTransportMetricsImpl inTransportMetrics = new HttpTransportMetricsImpl();
final HttpTransportMetricsImpl outTransportMetrics = new HttpTransportMetricsImpl();
this.inbuffer = new SessionInputBufferImpl(inTransportMetrics, buffersize, -1,
constraints != null ? constraints : MessageConstraints.DEFAULT, chardecoder);
this.outbuffer = new SessionOutputBufferImpl(outTransportMetrics, buffersize, fragmentSizeHint,
charencoder);
this.connMetrics = new HttpConnectionMetricsImpl(inTransportMetrics, outTransportMetrics);
this.incomingContentStrategy = incomingContentStrategy != null ? incomingContentStrategy :
LaxContentLengthStrategyHC4.INSTANCE;
this.outgoingContentStrategy = outgoingContentStrategy != null ? outgoingContentStrategy :
StrictContentLengthStrategyHC4.INSTANCE;
}
示例2: SessionInputBufferImpl
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Creates new instance of SessionInputBufferImpl.
*
* @param metrics HTTP transport metrics.
* @param buffersize buffer size. Must be a positive number.
* @param minChunkLimit size limit below which data chunks should be buffered in memory
* in order to minimize native method invocations on the underlying network socket.
* The optimal value of this parameter can be platform specific and defines a trade-off
* between performance of memory copy operations and that of native method invocation.
* If negative default chunk limited will be used.
* @param constraints Message constraints. If <code>null</code>
* {@link MessageConstraints#DEFAULT} will be used.
* @param chardecoder chardecoder to be used for decoding HTTP protocol elements.
* If <code>null</code> simple type cast will be used for byte to char conversion.
*/
public SessionInputBufferImpl(
final HttpTransportMetricsImpl metrics,
final int buffersize,
final int minChunkLimit,
final MessageConstraints constraints,
final CharsetDecoder chardecoder) {
Args.notNull(metrics, "HTTP transport metrcis");
Args.positive(buffersize, "Buffer size");
this.metrics = metrics;
this.buffer = new byte[buffersize];
this.bufferpos = 0;
this.bufferlen = 0;
this.minChunkLimit = minChunkLimit >= 0 ? minChunkLimit : 512;
this.constraints = constraints != null ? constraints : MessageConstraints.DEFAULT;
this.linebuffer = new ByteArrayBuffer(buffersize);
this.decoder = chardecoder;
}
示例3: DefaultServiceUnavailableRetryStrategy
import org.apache.http.util.Args; //导入方法依赖的package包/类
public DefaultServiceUnavailableRetryStrategy(final int maxRetries, final int retryInterval) {
super();
Args.positive(maxRetries, "Max retries");
Args.positive(retryInterval, "Retry interval");
this.maxRetries = maxRetries;
this.retryInterval = retryInterval;
}
示例4: SessionOutputBufferImpl
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Creates new instance of SessionOutputBufferImpl.
*
* @param metrics HTTP transport metrics.
* @param buffersize buffer size. Must be a positive number.
* @param fragementSizeHint fragment size hint defining a minimal size of a fragment
* that should be written out directly to the socket bypassing the session buffer.
* Value <code>0</code> disables fragment buffering.
* @param charencoder charencoder to be used for encoding HTTP protocol elements.
* If <code>null</code> simple type cast will be used for char to byte conversion.
*/
public SessionOutputBufferImpl(
final HttpTransportMetricsImpl metrics,
final int buffersize,
final int fragementSizeHint,
final CharsetEncoder charencoder) {
super();
Args.positive(buffersize, "Buffer size");
Args.notNull(metrics, "HTTP transport metrcis");
this.metrics = metrics;
this.buffer = new ByteArrayBuffer(buffersize);
this.fragementSizeHint = fragementSizeHint >= 0 ? fragementSizeHint : 0;
this.encoder = charencoder;
}
示例5: setDefaultMaxPerRoute
import org.apache.http.util.Args; //导入方法依赖的package包/类
public void setDefaultMaxPerRoute(final int max) {
Args.positive(max, "Default max per route");
this.defaultMax = max;
}
示例6: setMaxForRoute
import org.apache.http.util.Args; //导入方法依赖的package包/类
public void setMaxForRoute(final HttpRoute route, final int max) {
Args.notNull(route, "HTTP route");
Args.positive(max, "Max per route");
this.maxPerHostMap.put(route, Integer.valueOf(max));
}
示例7: setCooldownMillis
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Sets the amount of time, in milliseconds, to wait between
* adjustments in pool sizes for a given host, to allow
* enough time for the adjustments to take effect. Defaults
* to 5000L (5 seconds).
* @param l must be positive
*/
public void setCooldownMillis(final long l) {
Args.positive(coolDown, "Cool down");
coolDown = l;
}
示例8: setPerHostConnectionCap
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Sets the absolute maximum per-host connection pool size to
* probe up to; defaults to 2 (the default per-host max).
* @param cap must be >= 1
*/
public void setPerHostConnectionCap(final int cap) {
Args.positive(cap, "Per host connection cap");
this.cap = cap;
}
示例9: setPerHostConnectionCap
import org.apache.http.util.Args; //导入方法依赖的package包/类
/**
* Sets the absolute maximum per-host connection pool size to
* probe up to; defaults to 2 (the default per-host max).
* @param cap must be >= 1
*/
public void setPerHostConnectionCap(final int cap) {
Args.positive(cap, "Per host connection cap");
this.cap = cap;
}