org.brewchain.sdk.contract.rlp.util.NotationParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cwvj Show documentation
Show all versions of cwvj Show documentation
Java sdk for Dapps interact with cwv blockchain node
/*
Copyright 2019 Evan Saulpaugh
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.brewchain.sdk.contract.rlp.util;
import java.util.ArrayList;
import java.util.List;
/**
* Decodes RLP object notation as defined by the {@link Notation} class.
*/
public class NotationParser {
private static final int LIST = 0;
private static final int STRING = 1;
private static final int LIST_PREFIX_LEN = Notation.BEGIN_LIST.length();
private static final int LIST_SUFFIX_LEN = Notation.END_LIST.length();
private static final int STRING_PREFIX_LEN = Notation.BEGIN_STRING.length();
private static final int STRING_SUFFIX_LEN = Notation.END_STRING.length();
/**
* Returns the object hierarchy represented by the notation.
*
* @param notation the notation to be parsed
* @return the hierarchy of objects
*/
public static List