Package org.apache.bookkeeper.util
Class StringUtils
java.lang.Object
org.apache.bookkeeper.util.StringUtils
Provided utilities for parsing network addresses, ledger-id from node paths
etc.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetHybridHierarchicalLedgerPath(long ledgerId) static StringgetLongHierarchicalLedgerPath(long ledgerId) Get the long hierarchical ledger path according to the ledger id.static StringgetShortHierarchicalLedgerPath(long ledgerId) Get the hierarchical ledger path according to the ledger id.static StringgetZKStringId(long id) Formats ledger ID according to ZooKeeper rules.static StringgetZKStringIdForLongHierarchical(long id) Formats ledger ID according to ZooKeeper rules.static StringrequestToString(Object request) Builds string representation of the request without extra (i.e.static longstringToHierarchicalLedgerId(String hierarchicalLedgerPath) Parse the hierarchical ledger path to its ledger id.static longstringToHierarchicalLedgerId(String... levelNodes) Get ledger id.static longstringToLongHierarchicalLedgerId(String longHierarchicalLedgerPath) Parse the long hierarchical ledger path to its ledger id.
-
Field Details
-
LEDGER_NODE_PREFIX
- See Also:
-
FLAT_LEDGER_NODE_REGEX
- See Also:
-
LEGACYHIERARCHICAL_LEDGER_PARENT_NODE_REGEX
- See Also:
-
LONGHIERARCHICAL_LEDGER_PARENT_NODE_REGEX
- See Also:
-
HIERARCHICAL_LEDGER_PARENT_NODE_REGEX
- See Also:
-
-
Constructor Details
-
StringUtils
public StringUtils()
-
-
Method Details
-
getZKStringId
Formats ledger ID according to ZooKeeper rules.- Parameters:
id- znode id
-
getZKStringIdForLongHierarchical
Formats ledger ID according to ZooKeeper rules.- Parameters:
id- znode id
-
getShortHierarchicalLedgerPath
Get the hierarchical ledger path according to the ledger id.- Parameters:
ledgerId- ledger id- Returns:
- the hierarchical path
-
getLongHierarchicalLedgerPath
Get the long hierarchical ledger path according to the ledger id.- Parameters:
ledgerId- ledger id- Returns:
- the long hierarchical path
-
getHybridHierarchicalLedgerPath
-
stringToHierarchicalLedgerId
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
Get ledger id.- Parameters:
levelNodes- level of the ledger path- Returns:
- ledger id
- Throws:
IOException
-
requestToString
Builds string representation of the request without extra (i.e. binary) data- Parameters:
request-- Returns:
- string representation of request
-