本文整理了Java中java.lang.Short.decode()
方法的一些代码示例,展示了Short.decode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Short.decode()
方法的具体详情如下:
包路径:java.lang.Short
类名称:Short
方法名:decode
[英]Parses the specified string and returns a Short instance if the string can be decoded into a short value. The string may be an optional minus sign "-" followed by a hexadecimal ("0x..." or "#..."), octal ("0..."), or decimal ("...") representation of a short.
[中]解析指定的字符串,如果该字符串可以解码为短值,则返回一个短实例。字符串可以是可选的减号“-”,后跟十六进制(“0x…”或“#…”,八进制(“0…”),或十进制(“…”)表示一个简短的句子。
代码示例来源:origin: google/guava
@Override
protected Short doForward(String value) {
return Short.decode(value);
}
代码示例来源:origin: prestodb/presto
@Override
protected Short doForward(String value) {
return Short.decode(value);
}
代码示例来源:origin: google/j2objc
@Override
protected Short doForward(String value) {
return Short.decode(value);
}
代码示例来源:origin: wildfly/wildfly
@Override
protected Short doForward(String value) {
return Short.decode(value);
}
代码示例来源:origin: vavr-io/vavr
/**
* Decodes this {@code CharSeq} into a {@code Short} by calling {@link Short#decode(String)}.
* <p>
* We write
*
* <pre><code>
* Short value = charSeq.decodeShort();
* </code></pre>
*
* instead of
*
* <pre><code>
* Short value = Short.decode(charSeq.mkString());
* </code></pre>
*
* @return a {@code Short} object holding the short value represented by this {@code CharSeq}
* @throws NumberFormatException if this {@code CharSeq} does not contain a parsable short.
*/
public Short decodeShort() {
return Short.decode(back);
}
代码示例来源:origin: wildfly/wildfly
public Short parseValue(final String string, final ClassLoader classLoader) throws IllegalArgumentException {
return Short.decode(string.trim());
}
});
代码示例来源:origin: com.h2database/h2
/**
* Returns the value as a short.
*
* @param columnIndex (1,2,...)
* @return the value
*/
@Override
public short getShort(int columnIndex) throws SQLException {
Object o = get(columnIndex);
if (o != null && !(o instanceof Number)) {
o = Short.decode(o.toString());
}
return o == null ? 0 : ((Number) o).shortValue();
}
代码示例来源:origin: remkop/picocli
public Short convert(String s) {
return Short.decode(s);
}
};
代码示例来源:origin: lealone/Lealone
/**
* Returns the value as a short.
*
* @param columnIndex (1,2,...)
* @return the value
*/
@Override
public short getShort(int columnIndex) throws SQLException {
Object o = get(columnIndex);
if (o != null && !(o instanceof Number)) {
o = Short.decode(o.toString());
}
return o == null ? 0 : ((Number) o).shortValue();
}
代码示例来源:origin: spring-projects/spring-framework
return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed));
代码示例来源:origin: alipay/sofa-rpc
resultList[i] = Byte.decode(value);
} else if (short.class.equals(cl) || Short.class.equals(cl)) {
resultList[i] = Short.decode(value);
} else if (char.class.equals(cl) || Character.class.equals(cl)) {
resultList[i] = Character.valueOf(value.charAt(0));
代码示例来源:origin: alipay/sofa-rpc
resultList[i] = Byte.decode(value);
} else if (short.class.equals(cl) || Short.class.equals(cl)) {
resultList[i] = Short.decode(value);
} else if (char.class.equals(cl) || Character.class.equals(cl)) {
resultList[i] = Character.valueOf(value.charAt(0));
代码示例来源:origin: org.springframework/spring-core
return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed));
代码示例来源:origin: com.h2database/h2
break;
case Types.TINYINT:
rs.updateShort(columnIndex, Short.decode(x));
break;
default:
代码示例来源:origin: apache/hive
@Test
public void testFsPermissionOperation() {
HashMap<String, Integer> permsCode = new HashMap<String, Integer>();
for (int i = 0; i < 8; i++) {
for (int j = 0; j < 8; j++) {
for (int k = 0; k < 8; k++) {
StringBuilder sb = new StringBuilder();
sb.append("0");
sb.append(i);
sb.append(j);
sb.append(k);
Integer code = (((i * 8) + j) * 8) + k;
String perms = (new FsPermission(Short.decode(sb.toString()))).toString();
if (permsCode.containsKey(perms)) {
Assert.assertEquals("permissions(" + perms + ") mapped to multiple codes", code, permsCode.get(perms));
}
permsCode.put(perms, code);
assertFsPermissionTransformationIsGood(perms);
}
}
}
}
代码示例来源:origin: apache/hive
private static void validatePermissions(CliSessionState ss, HiveConf conf, String perms) {
perms = perms.trim();
FsPermission fp = null;
if (perms.matches("^\\s*([r,w,x,-]{9})\\s*$")) {
fp = FsPermission.valueOf("d" + perms);
} else if (perms.matches("^\\s*([0-7]{3})\\s*$")) {
fp = new FsPermission(Short.decode("0" + perms));
} else {
ss.err.println("Invalid permission specification: " + perms);
sysExit(ss,1);
}
if (!HCatUtil.validateMorePermissive(fp.getUserAction(), fp.getGroupAction())) {
ss.err.println("Invalid permission specification: " + perms + " : user permissions must be more permissive than group permission ");
sysExit(ss,1);
}
if (!HCatUtil.validateMorePermissive(fp.getGroupAction(), fp.getOtherAction())) {
ss.err.println("Invalid permission specification: " + perms + " : group permissions must be more permissive than other permission ");
sysExit(ss,1);
}
if ((!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getUserAction())) ||
(!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getGroupAction())) ||
(!HCatUtil.validateExecuteBitPresentIfReadOrWrite(fp.getOtherAction()))) {
ss.err.println("Invalid permission specification: " + perms + " : permissions must have execute permissions if read or write permissions are specified ");
sysExit(ss,1);
}
conf.set(HCatConstants.HCAT_PERMS, "d" + fp.toString());
}
代码示例来源:origin: aws-amplify/aws-sdk-android
@Override
public Short getShort(String propertyName) {
Short value = null;
String valueString = properties.get(propertyName);
if (valueString != null) {
try {
if (properties.containsKey(propertyName)) {
value = Short.decode(valueString);
}
} catch (Exception ex) {
Log.e(TAG, String.format("Could not get Short for propertyName: %s", propertyName),
ex);
}
}
return value;
}
代码示例来源:origin: aws-amplify/aws-sdk-android
public Short getShort(final String propertyName) {
Short value = null;
String valueString = properties.get(propertyName);
if (valueString != null) {
try {
if (properties.containsKey(propertyName)) {
value = Short.decode(valueString);
}
} catch (Exception ex) {
// Do not log property due to potential sensitive information.
log.error("Could not get Short for property.");
}
}
return value;
}
代码示例来源:origin: apache/tika
j++;
decoded.write(Short.decode(
"0" + value.substring(i + 1, j)).byteValue());
i = j - 1;
代码示例来源:origin: camunda/camunda-bpm-platform
return (T) (isHexNumber(trimmed) ? Short.decode(trimmed) : Short.valueOf(trimmed));
内容来源于网络,如有侵权,请联系作者删除!