Java Code Examples for org.ethereum.util.Value#asBytes()
The following examples show how to use
org.ethereum.util.Value#asBytes() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TrieImpl.java From ethereumj with MIT License | 6 votes |
/** * Helper method to retrieve the actual node * If the node is not a list and length is > 32 * bytes get the actual node from the db * * @param node - * @return */ private Value getNode(Object node) { Value val = new Value(node); // in that case we got a node // so no need to encode it if (!val.isBytes()) { return val; } byte[] keyBytes = val.asBytes(); if (keyBytes.length == 0) { return val; } else if (keyBytes.length < 32) { return new Value(keyBytes); } return this.cache.get(keyBytes); }
Example 2
Source File: TrieImpl.java From ethereumj with MIT License | 5 votes |
@Override public byte[] get(byte[] key) { if (logger.isDebugEnabled()) logger.debug("Retrieving key {}", Hex.toHexString(key)); byte[] k = binToNibbles(key); Value c = new Value(this.get(this.root, k)); return (c == null)? null : c.asBytes(); }
Example 3
Source File: Serializers.java From nuls-v2 with MIT License | 4 votes |
@Override public byte[] serialize(Value object) { return object.asBytes(); }
Example 4
Source File: Serializers.java From nuls with MIT License | 4 votes |
@Override public byte[] serialize(Value object) { return object.asBytes(); }