本文整理了Java中io.vertx.core.impl.Arguments.require()
方法的一些代码示例,展示了Arguments.require()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Arguments.require()
方法的具体详情如下:
包路径:io.vertx.core.impl.Arguments
类名称:Arguments
方法名:require
[英]Checks that the specified condition is fulfilled and throws a customized IllegalArgumentException if it is false.
[中]检查指定的条件是否满足,如果为false,则抛出自定义的IllegalArgumentException。
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the {@literal SETTINGS_INITIAL_WINDOW_SIZE} HTTP/2 setting
*
* @param initialWindowSize the new value
* @return a reference to this, so the API can be used fluently
*/
public Http2Settings setInitialWindowSize(int initialWindowSize) {
Arguments.require(initialWindowSize >= Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE,
"initialWindowSize must be >= " + Http2CodecUtil.MIN_INITIAL_WINDOW_SIZE);
this.initialWindowSize = initialWindowSize;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the TCP send buffer size
*
* @param sendBufferSize the buffers size, in bytes
* @return a reference to this, so the API can be used fluently
*/
public NetworkOptions setSendBufferSize(int sendBufferSize) {
Arguments.require(sendBufferSize > 0 || sendBufferSize == DEFAULT_SEND_BUFFER_SIZE, "sendBufferSize must be > 0");
this.sendBufferSize = sendBufferSize;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* set to {@code initialBufferSizeHttpDecoder} the initial buffer of the HttpDecoder.
*
* @param decoderInitialBufferSize the initial buffer size
* @return a reference to this, so the API can be used fluently
*/
public HttpClientOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) {
Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0");
this.decoderInitialBufferSize = decoderInitialBufferSize;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the send timeout.
*
* @param timeout the timeout value, in ms.
* @return a reference to this, so the API can be used fluently
*/
public DeliveryOptions setSendTimeout(long timeout) {
Arguments.require(timeout >= 1, "sendTimeout must be >= 1");
this.timeout = timeout;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Flip the parser into fixed size mode, where the record size is specified by {@code size} in bytes.
* <p>
* This method can be called multiple times with different values of size while data is being parsed.
*
* @param size the new record size
*/
public void fixedSizeMode(int size) {
Arguments.require(size > 0, "Size must be > 0");
delimited = false;
recordSize = size;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the TCP receive buffer size
*
* @param receiveBufferSize the buffers size, in bytes
* @return a reference to this, so the API can be used fluently
*/
public NetworkOptions setReceiveBufferSize(int receiveBufferSize) {
Arguments.require(receiveBufferSize > 0 || receiveBufferSize == DEFAULT_RECEIVE_BUFFER_SIZE, "receiveBufferSize must be > 0");
this.receiveBufferSize = receiveBufferSize;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the initial buffer size for the HTTP decoder
* @param decoderInitialBufferSize the initial size
* @return a reference to this, so the API can be used fluently
*/
public HttpServerOptions setDecoderInitialBufferSize(int decoderInitialBufferSize) {
Arguments.require(decoderInitialBufferSize > 0, "initialBufferSizeHttpDecoder must be > 0");
this.decoderInitialBufferSize = decoderInitialBufferSize;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Set the multicast ttl value
*
* @param multicastTimeToLive the multicast ttl value
* @return a reference to this, so the API can be used fluently
*/
public DatagramSocketOptions setMulticastTimeToLive(int multicastTimeToLive) {
Arguments.require(multicastTimeToLive >= 0, "multicastTimeToLive must be >= 0");
this.multicastTimeToLive = multicastTimeToLive;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public InboundBuffer(Context context, long highWaterMark) {
Objects.requireNonNull(context, "context must not be null");
Arguments.require(highWaterMark >= 0, "highWaterMark " + highWaterMark + " >= 0");
this.context = context;
this.highWaterMark = highWaterMark;
this.demand = Long.MAX_VALUE;
this.pending = new ArrayDeque<>();
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public Buffer getBytes(int start, int end, byte[] dst, int dstIndex) {
Arguments.require(end >= start, "end must be greater or equal than start");
buffer.getBytes(start, dst, dstIndex, end - start);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public synchronized AsyncFile setWriteQueueMaxSize(int maxSize) {
Arguments.require(maxSize >= 2, "maxSize must be >= 2");
check();
this.maxWrites = maxSize;
this.lwm = maxWrites / 2;
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
public byte[] getBytes(int start, int end) {
Arguments.require(end >= start, "end must be greater or equal than start");
byte[] arr = new byte[end - start];
buffer.getBytes(start, arr, 0, end - start);
return arr;
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public ReadStream<Buffer> fetch(long amount) {
Arguments.require(amount > 0, "Fetch amount must be > 0L");
demand += amount;
if (demand < 0L) {
demand = Long.MAX_VALUE;
}
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Add a key as a buffer
*
* @param keyValue the key to add
* @return a reference to this, so the API can be used fluently
*/
@GenIgnore
public PemKeyCertOptions addKeyValue(Buffer keyValue) {
Arguments.require(keyValue != null, "Null keyValue");
keyValues.add(keyValue);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Add a path to a certificate file
*
* @param certPath the path to the certificate file
* @return a reference to this, so the API can be used fluently
*/
@GenIgnore
public PemKeyCertOptions addCertPath(String certPath) {
Arguments.require(certPath != null, "Null certPath");
certPaths.add(certPath);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public JsonParser fetch(long amount) {
Arguments.require(amount > 0L, "Fetch amount must be > 0L");
demand += amount;
if (demand < 0L) {
demand = Long.MAX_VALUE;
}
checkPending();
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Add a certificate as a buffer
*
* @param certValue the certificate to add
* @return a reference to this, so the API can be used fluently
*/
@GenIgnore
public PemKeyCertOptions addCertValue(Buffer certValue) {
Arguments.require(certValue != null, "Null certValue");
certValues.add(certValue);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public synchronized AsyncFile read(Buffer buffer, int offset, long position, int length, Handler<AsyncResult<Buffer>> handler) {
Objects.requireNonNull(buffer, "buffer");
Objects.requireNonNull(handler, "handler");
Arguments.require(offset >= 0, "offset must be >= 0");
Arguments.require(position >= 0, "position must be >= 0");
Arguments.require(length >= 0, "length must be >= 0");
check();
ByteBuffer bb = ByteBuffer.allocate(length);
doRead(buffer, offset, bb, position, getReadSize(), handler);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
/**
* Add a path to a key file
*
* @param keyPath the path to the key file
* @return a reference to this, so the API can be used fluently
*/
@GenIgnore
public PemKeyCertOptions addKeyPath(String keyPath) {
Arguments.require(keyPath != null, "Null keyPath");
keyPaths.add(keyPath);
return this;
}
代码示例来源:origin: eclipse-vertx/vert.x
@Override
public void getLockWithTimeout(String name, long timeout, Handler<AsyncResult<Lock>> resultHandler) {
Objects.requireNonNull(name, "name");
Objects.requireNonNull(resultHandler, "resultHandler");
Arguments.require(timeout >= 0, "timeout must be >= 0");
if (clusterManager == null) {
getLocalLock(name, timeout, resultHandler);
} else {
clusterManager.getLockWithTimeout(name, timeout, resultHandler);
}
}
内容来源于网络,如有侵权,请联系作者删除!