|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.opentsdb.core.Tags
public final class Tags
Helper functions to deal with tags.
Method Summary | |
---|---|
static void |
parse(HashMap<String,String> tags,
String tag)
Parses a tag into a HashMap. |
static long |
parseLong(CharSequence s)
Parses an integer value as a long from the given character sequence. |
static String |
parseWithMetric(String metric,
HashMap<String,String> tags)
Parses the metric and tags out of the given string. |
static String[] |
splitString(String s,
char c)
Optimized version of String#split that doesn't use regexps. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String[] splitString(String s, char c)
String#split
that doesn't use regexps.
This function works in O(5n) where n is the length of the string to
split.
s
- The string to split.c
- The separator to use to split the string.
public static void parse(HashMap<String,String> tags, String tag)
tags
- The HashMap into which to store the tag.tag
- A String of the form "tag=value".
IllegalArgumentException
- if the tag is malformed.
IllegalArgumentException
- if the tag was already in tags with a
different value.public static String parseWithMetric(String metric, HashMap<String,String> tags)
metric
- A string of the form "metric" or "metric{tag=value,...}".tags
- The map to populate with the tags parsed out of the first
argument.
IllegalArgumentException
- if the metric is malformed.public static long parseLong(CharSequence s)
This is equivalent to Long.parseLong(String)
except it's up to
100% faster on String
and always works in O(1) space even with
StringBuilder
buffers (where it's 2x to 5x faster).
s
- The character sequence containing the integer value to parse.
NumberFormatException
- if the value is malformed or overflows.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |