org.apache.hc.core5.util.Args.positive()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(107)

本文整理了Java中org.apache.hc.core5.util.Args.positive()方法的一些代码示例,展示了Args.positive()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.positive()方法的具体详情如下:
包路径:org.apache.hc.core5.util.Args
类名称:Args
方法名:positive

Args.positive介绍

暂无

代码示例

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

@Override
public void setCode(final int code) {
  Args.positive(code, "Status code");
  this.code = code;
  this.reasonPhrase = null;
}

代码示例来源:origin: apache/httpcomponents-core

/**
 * Creates a new response.
 *
 * @param code          the status code of the response
 * @param reasonPhrase  the reason phrase to the status code, or {@code null}
 */
public BasicHttpResponse(final int code, final String reasonPhrase) {
  this.code = Args.positive(code, "Status code");
  this.reasonPhrase = reasonPhrase;
  this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5

public DefaultServiceUnavailableRetryStrategy(final int maxRetries, final int defaultRetryInterval) {
  super();
  Args.positive(maxRetries, "Max retries");
  Args.positive(defaultRetryInterval, "Retry interval");
  this.maxRetries = maxRetries;
  this.defaultRetryInterval = defaultRetryInterval;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

/**
 * Creates a new response.
 *
 * @param code          the status code of the response
 * @param reasonPhrase  the reason phrase to the status code, or {@code null}
 */
public BasicHttpResponse(final int code, final String reasonPhrase) {
  this.code = Args.positive(code, "Status code");
  this.reasonPhrase = reasonPhrase;
  this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

/**
 * Creates a new response.
 *
 * @param code          the status code of the response
 */
public BasicHttpResponse(final int code) {
  this.code = Args.positive(code, "Status code");
  this.reasonPhrase = null;
  this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
}

代码示例来源:origin: apache/httpcomponents-core

@Override
public void setDefaultMaxPerRoute(final int max) {
  Args.positive(max, "Max value");
  defaultMaxPerRoute = max;
}

代码示例来源:origin: org.apache.httpcomponents.client5/httpclient5

/**
 * 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;
}

代码示例来源:origin: apache/httpcomponents-core

public Builder setMaxConcurrentStreams(final int maxConcurrentStreams) {
  Args.positive(maxConcurrentStreams, "Max concurrent streams");
  this.maxConcurrentStreams = maxConcurrentStreams;
  return this;
}

代码示例来源:origin: apache/httpcomponents-core

/**
 * Creates a new response.
 *
 * @param code          the status code of the response
 */
public BasicHttpResponse(final int code) {
  this.code = Args.positive(code, "Status code");
  this.reasonPhrase = null;
  this.reasonCatalog = EnglishReasonPhraseCatalog.INSTANCE;
}

代码示例来源:origin: apache/httpcomponents-core

@Override
public void setCode(final int code) {
  Args.positive(code, "Status code");
  this.code = code;
  this.reasonPhrase = null;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

public AbstractBinAsyncEntityProducer(
    final int bufferSize,
    final int fragmentSizeHint,
    final ContentType contentType) {
  Args.positive(bufferSize, "Buffer size");
  this.bytebuf = ByteBuffer.allocate(bufferSize);
  this.fragmentSizeHint = fragmentSizeHint >= 0 ? fragmentSizeHint : bufferSize / 2;
  this.contentType = contentType;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

@Override
public void setDefaultMaxPerRoute(final int max) {
  Args.positive(max, "Max value");
  this.lock.lock();
  try {
    this.defaultMaxPerRoute = max;
  } finally {
    this.lock.unlock();
  }
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

@Override
public void setMaxTotal(final int max) {
  Args.positive(max, "Max value");
  this.lock.lock();
  try {
    this.maxTotal = max;
  } finally {
    this.lock.unlock();
  }
}

代码示例来源:origin: apache/httpcomponents-core

public FrameOutputBuffer(final BasicH2TransportMetrics metrics, final int maxFramePayloadSize) {
  super();
  Args.notNull(metrics, "HTTP2 transport metrcis");
  Args.positive(maxFramePayloadSize, "Maximum payload size");
  this.metrics = metrics;
  this.maxFramePayloadSize = maxFramePayloadSize;
  this.buffer = new byte[FrameConsts.HEAD_LEN + maxFramePayloadSize + FrameConsts.MAX_PADDING + 1];
}

代码示例来源:origin: apache/httpcomponents-core

public StringAsyncEntityConsumer(final int capacityIncrement) {
  Args.positive(capacityIncrement, "Capacity increment");
  this.capacityIncrement = capacityIncrement;
  this.content = new CharArrayBuffer(1024);
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

public AbstractClassicServerExchangeHandler(final int initialBufferSize, final Executor executor) {
  this.initialBufferSize = Args.positive(initialBufferSize, "Initial buffer size");
  this.executor = Args.notNull(executor, "Executor");
  this.exception = new AtomicReference<>(null);
  this.state = new AtomicReference<>(State.IDLE);
}

代码示例来源:origin: apache/httpcomponents-core

FrameInputBuffer(final BasicH2TransportMetrics metrics, final int bufferLen, final int maxFramePayloadSize) {
  Args.notNull(metrics, "HTTP2 transport metrcis");
  Args.positive(maxFramePayloadSize, "Maximum payload size");
  this.metrics = metrics;
  this.maxFramePayloadSize = maxFramePayloadSize;
  this.buffer = new byte[bufferLen];
  this.dataLen = 0;
}

代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5

public StringAsyncEntityConsumer(final int capacityIncrement) {
  Args.positive(capacityIncrement, "Capacity increment");
  this.capacityIncrement = capacityIncrement;
  this.content = new CharArrayBuffer(1024);
}

代码示例来源:origin: apache/httpcomponents-core

@Override
public RawFrame createHeaders(final int streamId, final ByteBuffer payload, final boolean endHeaders, final boolean endStream) {
  Args.positive(streamId, "Stream id");
  final int flags = (endHeaders ? FrameFlag.END_HEADERS.value : 0) | (endStream ? FrameFlag.END_STREAM.value : 0);
  return new RawFrame(FrameType.HEADERS.getValue(), flags, streamId, payload);
}

代码示例来源:origin: apache/httpcomponents-core

@Override
public RawFrame createData(final int streamId, final ByteBuffer payload, final boolean endStream) {
  Args.positive(streamId, "Stream id");
  final int flags = (endStream ? FrameFlag.END_STREAM.value : 0);
  return new RawFrame(FrameType.DATA.getValue(), flags, streamId, payload);
}

相关文章