本文整理了Java中com.fasterxml.jackson.databind.JsonNode.isBinary()
方法的一些代码示例,展示了JsonNode.isBinary()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonNode.isBinary()
方法的具体详情如下:
包路径:com.fasterxml.jackson.databind.JsonNode
类名称:JsonNode
方法名:isBinary
[英]Method that can be used to check if this node represents binary data (Base64 encoded). Although this will be externally written as JSON String value, #isTextual will return false if this method returns true.
[中]方法,该方法可用于检查此节点是否表示二进制数据(Base64编码)。虽然这将在外部写入JSON字符串值,但如果此方法返回true,则#isTextual将返回false。
代码示例来源:origin: prestodb/presto
private Object toValue(JsonNode node)
throws IOException
{
if (node.isTextual()) {
return node.asText();
}
else if (node.isNumber()) {
return node.numberValue();
}
else if (node.isBoolean()) {
return node.asBoolean();
}
else if (node.isBinary()) {
return node.binaryValue();
}
else {
throw new IllegalStateException("Unexpected range bound value: " + node);
}
}
}
代码示例来源:origin: redisson/redisson
@Override
public String getText()
{
if (_closed) {
return null;
}
// need to separate handling a bit...
switch (_currToken) {
case FIELD_NAME:
return _nodeCursor.getCurrentName();
case VALUE_STRING:
return currentNode().textValue();
case VALUE_NUMBER_INT:
case VALUE_NUMBER_FLOAT:
return String.valueOf(currentNode().numberValue());
case VALUE_EMBEDDED_OBJECT:
JsonNode n = currentNode();
if (n != null && n.isBinary()) {
// this will convert it to base64
return n.asText();
}
default:
return (_currToken == null) ? null : _currToken.asString();
}
}
代码示例来源:origin: redisson/redisson
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: apache/usergrid
return json.asText();
else if ( json.isBinary() ) {
try {
return wrap( json.binaryValue() );
代码示例来源:origin: apache/usergrid
return prepStringForIndex( json.asText() );
else if ( json.isBinary() ) {
try {
return wrap( json.binaryValue());
代码示例来源:origin: briandilley/jsonrpc4j
return type.isArray() || Collection.class.isAssignableFrom(type);
if (node.isBinary()) {
return byteOrCharAssignable(type);
代码示例来源:origin: com.unboundid.product.scim2/scim2-sdk-common
/**
* Determines whether the provided JSON nodes have the same JSON data type.
* @param n1 The first node.
* @param n2 The second node.
* @return {@code true} iff the nodes have the same JSON data type.
*/
public boolean isSameType(final JsonNode n1, final JsonNode n2)
{
return (n1.getNodeType() == n2.getNodeType() ||
((n1.isTextual() || n1.isBinary()) &&
(n2.isTextual() || n2.isBinary())));
}
}
代码示例来源:origin: GluuFederation/oxAuth
public String verifyThatBinary(JsonNode node) {
if (!node.isBinary()) {
throw new Fido2RPRuntimeException("Invalid field " + node);
}
return node.asText();
}
代码示例来源:origin: pingidentity/scim2
/**
* Determines whether the provided JSON nodes have the same JSON data type.
* @param n1 The first node.
* @param n2 The second node.
* @return {@code true} iff the nodes have the same JSON data type.
*/
public boolean isSameType(final JsonNode n1, final JsonNode n2)
{
return (n1.getNodeType() == n2.getNodeType() ||
((n1.isTextual() || n1.isBinary()) &&
(n2.isTextual() || n2.isBinary())));
}
}
代码示例来源:origin: lukas-krecan/JsonUnit
public NodeType getNodeType() {
if (jsonNode.isObject()) {
return NodeType.OBJECT;
} else if (jsonNode.isArray()) {
return NodeType.ARRAY;
} else if (jsonNode.isTextual()) {
return NodeType.STRING;
} else if (jsonNode.isNumber()) {
return NodeType.NUMBER;
} else if (jsonNode.isBoolean()) {
return NodeType.BOOLEAN;
} else if (jsonNode.isNull()) {
return NodeType.NULL;
} else if (jsonNode.isBinary()) {
return NodeType.STRING;
} else {
throw new IllegalStateException("Unexpected node type " + jsonNode);
}
}
代码示例来源:origin: MartinWeindel/presto-kudu
private Object toValue(JsonNode node) throws IOException {
if (node.isTextual()) {
return node.asText();
} else if (node.isNumber()) {
return node.numberValue();
} else if (node.isBoolean()) {
return node.asBoolean();
} else if (node.isBinary()) {
return node.binaryValue();
} else {
throw new IllegalStateException("Unexpected range bound value: " + node);
}
}
}
代码示例来源:origin: Yubico/java-webauthn-server
private static ByteArray getResponseBytes(AttestationObject attestationObject) {
final JsonNode response = attestationObject.getAttestationStatement().get("response");
if (response == null || !response.isBinary()) {
throw new IllegalArgumentException("Property \"response\" of android-safetynet attestation statement must be a binary value, was: " + response);
}
try {
return new ByteArray(response.binaryValue());
} catch (IOException ioe) {
throw ExceptionUtil.wrapAndLog(log, "response.isBinary() was true but response.binaryValue failed: " + response, ioe);
}
}
代码示例来源:origin: com.hubspot.rosetta/RosettaCore
private Object unwrapJsonValue(JsonNode node) {
if (node.isNull()) {
return null;
} else if (node.isBoolean()) {
return node.booleanValue();
} else if (node.isBinary()) {
return ((BinaryNode) node).binaryValue();
} else if (node.isNumber()) {
return node.numberValue();
} else {
return node.asText();
}
}
}
代码示例来源:origin: com.eclipsesource.jaxrs/jersey-all
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: com.fasterxml.jackson.core/com.springsource.com.fasterxml.jackson.core.jackson-databind
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: hstaudacher/osgi-jax-rs-connector
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: Nextdoor/bender
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: com.jwebmp.jackson.core/jackson-databind
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Override
public Object getEmbeddedObject()
{
if (!_closed) {
JsonNode n = currentNode();
if (n != null) {
if (n.isPojo()) {
return ((POJONode) n).getPojo();
}
if (n.isBinary()) {
return ((BinaryNode) n).binaryValue();
}
}
}
return null;
}
代码示例来源:origin: Yubico/java-webauthn-server
@Override
public boolean verifyAttestationSignature(AttestationObject attestationObject, ByteArray clientDataJsonHash) {
val signatureNode = attestationObject.getAttestationStatement().get("sig");
if (signatureNode == null || !signatureNode.isBinary()) {
throw new IllegalArgumentException("attStmt.sig must be set to a binary value.");
}
if (attestationObject.getAttestationStatement().has("x5c")) {
return verifyX5cSignature(attestationObject, clientDataJsonHash);
} else if (attestationObject.getAttestationStatement().has("ecdaaKeyId")) {
return verifyEcdaaSignature(attestationObject, clientDataJsonHash);
} else {
return verifySelfAttestationSignature(attestationObject, clientDataJsonHash);
}
}
内容来源于网络,如有侵权,请联系作者删除!