Class StringUtils

java.lang.Object
org.apache.bookkeeper.util.StringUtils

public class StringUtils extends Object
Provided utilities for parsing network addresses, ledger-id from node paths etc.
  • Field Details

  • Constructor Details

    • StringUtils

      public StringUtils()
  • Method Details

    • getZKStringId

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

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

      public static 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 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 String getHybridHierarchicalLedgerPath(long ledgerId)
    • stringToHierarchicalLedgerId

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

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

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

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