本文整理了Java中org.apache.hc.core5.util.Args.checkRange()
方法的一些代码示例,展示了Args.checkRange()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Args.checkRange()
方法的具体详情如下:
包路径:org.apache.hc.core5.util.Args
类名称:Args
方法名:checkRange
暂无
代码示例来源:origin: apache/httpcomponents-core
public Builder setMaxFrameSize(final int maxFrameSize) {
this.maxFrameSize = Args.checkRange(maxFrameSize, FrameConsts.MIN_FRAME_SIZE, FrameConsts.MAX_FRAME_SIZE,
"Invalid max frame size");
return this;
}
代码示例来源:origin: apache/httpcomponents-core
/**
* Checks a port number.
*
* @param port
* The port to check.
* @return the port
*
* @throws IllegalArgumentException
* If the port parameter is outside the specified range of valid port values, which is between 0 and
* 65535, inclusive.
*/
public static int check(final int port) {
return Args.checkRange(port, MIN_VALUE, MAX_VALUE, "Port number");
}
代码示例来源:origin: apache/httpcomponents-core
/**
* Checks a port number where {@code -1} indicates the scheme default port.
*
* @param port
* The port to check where {@code -1} indicates the scheme default port.
* @return the port
*
* @throws IllegalArgumentException
* If the port parameter is outside the specified range of valid port values, which is between 0 and
* 65535, inclusive. {@code -1} indicates the scheme default port.
*/
public static int checkWithDefault(final int port) {
return Args.checkRange(port, SCHEME_DEFAULT, MAX_VALUE,
"Port number(Use -1 to specify the scheme default port)");
}
代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5
/**
* Checks a port number.
*
* @param port
* The port to check.
* @return the port
*
* @throws IllegalArgumentException
* If the port parameter is outside the specified range of valid port values, which is between 0 and
* 65535, inclusive.
*/
public static int check(final int port) {
return Args.checkRange(port, MIN_VALUE, MAX_VALUE, "Port number");
}
代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5
/**
* Checks a port number where {@code -1} indicates the scheme default port.
*
* @param port
* The port to check where {@code -1} indicates the scheme default port.
* @return the port
*
* @throws IllegalArgumentException
* If the port parameter is outside the specified range of valid port values, which is between 0 and
* 65535, inclusive. {@code -1} indicates the scheme default port.
*/
public static int checkWithDefault(final int port) {
return Args.checkRange(port, SCHEME_DEFAULT, MAX_VALUE,
"Port number(Use -1 to specify the scheme default port)");
}
代码示例来源:origin: apache/httpcomponents-core
/**
* Obtains the reason phrase for a status code.
*
* @param status the status code, in the range 100-599
* @param loc ignored
*
* @return the reason phrase, or {@code null}
*/
@Override
public String getReason(final int status, final Locale loc) {
Args.checkRange(status, 100, 599, "Unknown category for status code");
final int category = status / 100;
final int subcode = status - 100*category;
String reason = null;
if (REASON_PHRASES[category].length > subcode) {
reason = REASON_PHRASES[category][subcode];
}
return reason;
}
代码示例来源:origin: org.apache.httpcomponents.core5/httpcore5
public static long checkContentLength(final EntityDetails entityDetails) {
// -1 is a special value
// 0 is allowed as well
return checkRange(entityDetails.getContentLength(), -1, Integer.MAX_VALUE,
"HTTP entity too large to be buffered in memory)");
}
代码示例来源:origin: apache/httpcomponents-core
public static long checkContentLength(final EntityDetails entityDetails) {
// -1 is a special value
// 0 is allowed as well
return checkRange(entityDetails.getContentLength(), -1, Integer.MAX_VALUE,
"HTTP entity too large to be buffered in memory)");
}
代码示例来源:origin: apache/httpcomponents-core
public void testIntSmallestRangeOK() {
Args.checkRange(0, 0, 0, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
public void testLongSmallestRangeOK() {
Args.checkRange(0L, 0L, 0L, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
public void testLongFullRangeOK() {
Args.checkRange(0L, Long.MIN_VALUE, Long.MAX_VALUE, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
public void testIntFullRangeOK() {
Args.checkRange(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testIntRangeFailHigh() {
Args.checkRange(101, -100, 100, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testIntSmallestRangeFailLow() {
Args.checkRange(-1, 0, 0, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testLongRangeFailLow() {
Args.checkRange(-101L, -100L, 100L, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testIntRangeFailLow() {
Args.checkRange(-101, -100, 100, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testLongSmallestRangeFailLow() {
Args.checkRange(-1L, 0L, 0L, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testIntSmallestRangeFailHigh() {
Args.checkRange(1, 0, 0, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testLongRangeFailHigh() {
Args.checkRange(101L, -100L, 100L, "Number");
}
代码示例来源:origin: apache/httpcomponents-core
@Test(expected = IllegalArgumentException.class)
public void testLongSmallestRangeFailHigh() {
Args.checkRange(1L, 0L, 0L, "Number");
}
内容来源于网络,如有侵权,请联系作者删除!