Class StringUtils


  • public class StringUtils
    extends java.lang.Object
    Provided utilites for parsing network addresses, ledger-id from node paths etc.
    • Field Detail

      • LEDGER_NODE_PREFIX

        public static final java.lang.String LEDGER_NODE_PREFIX
        See Also:
        Constant Field Values
      • FLAT_LEDGER_NODE_REGEX

        public static final java.lang.String FLAT_LEDGER_NODE_REGEX
        See Also:
        Constant Field Values
      • LEGACYHIERARCHICAL_LEDGER_PARENT_NODE_REGEX

        public static final java.lang.String LEGACYHIERARCHICAL_LEDGER_PARENT_NODE_REGEX
        See Also:
        Constant Field Values
      • LONGHIERARCHICAL_LEDGER_PARENT_NODE_REGEX

        public static final java.lang.String LONGHIERARCHICAL_LEDGER_PARENT_NODE_REGEX
        See Also:
        Constant Field Values
      • HIERARCHICAL_LEDGER_PARENT_NODE_REGEX

        public static final java.lang.String HIERARCHICAL_LEDGER_PARENT_NODE_REGEX
        See Also:
        Constant Field Values
    • Constructor Detail

      • StringUtils

        public StringUtils()
    • Method Detail

      • getZKStringId

        public static java.lang.String getZKStringId​(long id)
        Formats ledger ID according to ZooKeeper rules.
        Parameters:
        id - znode id
      • getZKStringIdForLongHierarchical

        public static java.lang.String getZKStringIdForLongHierarchical​(long id)
        Formats ledger ID according to ZooKeeper rules.
        Parameters:
        id - znode id
      • getShortHierarchicalLedgerPath

        public static java.lang.String getShortHierarchicalLedgerPath​(long ledgerId)
        Get the hierarchical ledger path according to the ledger id.
        Parameters:
        ledgerId - ledger id
        Returns:
        the hierarchical path
      • getLongHierarchicalLedgerPath

        public static java.lang.String getLongHierarchicalLedgerPath​(long ledgerId)
        Get the long hierarchical ledger path according to the ledger id.
        Parameters:
        ledgerId - ledger id
        Returns:
        the long hierarchical path
      • getHybridHierarchicalLedgerPath

        public static java.lang.String getHybridHierarchicalLedgerPath​(long ledgerId)
      • stringToHierarchicalLedgerId

        public static long stringToHierarchicalLedgerId​(java.lang.String hierarchicalLedgerPath)
                                                 throws java.io.IOException
        Parse the hierarchical ledger path to its ledger id.
        Parameters:
        hierarchicalLedgerPath -
        Returns:
        the ledger id
        Throws:
        java.io.IOException
      • stringToLongHierarchicalLedgerId

        public static long stringToLongHierarchicalLedgerId​(java.lang.String longHierarchicalLedgerPath)
                                                     throws java.io.IOException
        Parse the long hierarchical ledger path to its ledger id.
        Parameters:
        longHierarchicalLedgerPaths -
        Returns:
        the ledger id
        Throws:
        java.io.IOException
      • stringToHierarchicalLedgerId

        public static long stringToHierarchicalLedgerId​(java.lang.String... levelNodes)
                                                 throws java.io.IOException
        Get ledger id.
        Parameters:
        levelNodes - level of the ledger path
        Returns:
        ledger id
        Throws:
        java.io.IOException
      • requestToString

        public static java.lang.String requestToString​(java.lang.Object request)
        Builds string representation of teh request without extra (i.e. binary) data
        Parameters:
        request -
        Returns:
        string representation of request