io.vertx.core.impl.Arguments类的使用及代码示例

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

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

Arguments介绍

[英]Helper class to perform extended checks on arguments analogous to java.util.Objects#requireNonNull(Object,String).
[中]

代码示例

代码示例来源: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

public SocketAddressImpl(int port, String host) {
 Objects.requireNonNull(host, "no null host accepted");
 Arguments.require(!host.isEmpty(), "no empty host accepted");
 Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535");
 this.port = port;
 this.hostAddress = host;
 this.path = null;
}

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * Set the value of traffic class
 *
 * @param trafficClass  the value of traffic class
 * @return a reference to this, so the API can be used fluently
 */
public NetworkOptions setTrafficClass(int trafficClass) {
 Arguments.requireInRange(trafficClass, DEFAULT_TRAFFIC_CLASS, 255, "trafficClass tc must be 0 <= tc <= 255");
 this.trafficClass = trafficClass;
 return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

@Override
public WriteStream<Buffer> sender(int port, String host) {
 Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535");
 Objects.requireNonNull(host, "no null host accepted");
 return new PacketWriteStreamImpl(this, port, host);
}

代码示例来源: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: io.vertx/vertx-core

public SocketAddressImpl(int port, String host) {
 Objects.requireNonNull(host, "no null host accepted");
 Arguments.require(!host.isEmpty(), "no empty host accepted");
 Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535");
 this.port = port;
 this.hostAddress = host;
 this.path = null;
}

代码示例来源:origin: io.vertx/vertx-core

/**
 * Set the value of traffic class
 *
 * @param trafficClass  the value of traffic class
 * @return a reference to this, so the API can be used fluently
 */
public NetworkOptions setTrafficClass(int trafficClass) {
 Arguments.requireInRange(trafficClass, DEFAULT_TRAFFIC_CLASS, 255, "trafficClass tc must be 0 <= tc <= 255");
 this.trafficClass = trafficClass;
 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: io.vertx/vertx-core

@Override
public WriteStream<Buffer> sender(int port, String host) {
 Arguments.requireInRange(port, 0, 65535, "port p must be in range 0 <= p <= 65535");
 Objects.requireNonNull(host, "no null host accepted");
 return new PacketWriteStreamImpl(this, port, host);
}

代码示例来源: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 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 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

/**
 * 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 {@literal SETTINGS_MAX_HEADER_LIST_SIZE} HTTP/2 setting
 *
 * @param maxHeaderListSize the new value
 * @return a reference to this, so the API can be used fluently
 */
public Http2Settings setMaxHeaderListSize(long maxHeaderListSize) {
 Arguments.require(maxHeaderListSize >= 0, "maxHeaderListSize must be >= 0");
 Arguments.require(maxHeaderListSize >= Http2CodecUtil.MIN_HEADER_LIST_SIZE,
   "maxHeaderListSize must be >= " + Http2CodecUtil.MIN_HEADER_LIST_SIZE);
 this.maxHeaderListSize = maxHeaderListSize;
 return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * Set the maximum allowed size for a record when using the delimited mode.
 * The delimiter itself does not count for the record size.
 * <p>
 * If a record is longer than specified, an {@link IllegalStateException} will be thrown.
 *
 * @param size the maximum record size
 * @return  a reference to this, so the API can be used fluently
 */
public RecordParser maxRecordSize(int size) {
 Arguments.require(size > 0, "Size must be > 0");
 maxRecordSize = size;
 return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * Set {@literal SETTINGS_HEADER_TABLE_SIZE} HTTP/2 setting.
 *
 * @param headerTableSize the new value
 * @return a reference to this, so the API can be used fluently
 */
public Http2Settings setHeaderTableSize(long headerTableSize) {
 Arguments.require(headerTableSize >= Http2CodecUtil.MIN_HEADER_TABLE_SIZE,
   "headerTableSize must be >= " + Http2CodecUtil.MIN_HEADER_TABLE_SIZE);
 Arguments.require(headerTableSize <= Http2CodecUtil.MAX_HEADER_TABLE_SIZE,
   "headerTableSize must be <= " + Http2CodecUtil.MAX_HEADER_TABLE_SIZE);
 this.headerTableSize = headerTableSize;
 return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * Set the {@literal SETTINGS_MAX_CONCURRENT_STREAMS} HTTP/2 setting
 *
 * @param maxConcurrentStreams the new value
 * @return a reference to this, so the API can be used fluently
 */
public Http2Settings setMaxConcurrentStreams(long maxConcurrentStreams) {
 Arguments.require(maxConcurrentStreams >= Http2CodecUtil.MIN_CONCURRENT_STREAMS,
   "maxConcurrentStreams must be >= " + Http2CodecUtil.MIN_CONCURRENT_STREAMS);
 Arguments.require(maxConcurrentStreams <= Http2CodecUtil.MAX_CONCURRENT_STREAMS,
   "maxConcurrentStreams must be < " + Http2CodecUtil.MAX_CONCURRENT_STREAMS);
 this.maxConcurrentStreams = maxConcurrentStreams;
 return this;
}

代码示例来源:origin: eclipse-vertx/vert.x

/**
 * Set the {@literal SETTINGS_MAX_FRAME_SIZE} HTTP/2 setting
 *
 * @param maxFrameSize the new value
 * @return a reference to this, so the API can be used fluently
 */
public Http2Settings setMaxFrameSize(int maxFrameSize) {
 Arguments.require(maxFrameSize >= Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND,
   "maxFrameSize must be >= " + Http2CodecUtil.MAX_FRAME_SIZE_LOWER_BOUND);
 Arguments.require(maxFrameSize <= Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND,
   "maxFrameSize must be <= " + Http2CodecUtil.MAX_FRAME_SIZE_UPPER_BOUND);
 this.maxFrameSize = maxFrameSize;
 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<>();
}

相关文章