MCPcopy Create free account
hub / github.com/questdb/questdb / parseSubnet

Method parseSubnet

core/src/main/java/io/questdb/std/Numbers.java:2091–2099  ·  view source on GitHub ↗
(CharSequence sequence)

Source from the content-addressed store, hash-verified

2089 }
2090
2091 public static long parseSubnet(CharSequence sequence) throws NumericException {
2092 int delim = Chars.indexOf(sequence, 0, '/');
2093 if (delim == -1) {
2094 throw NumericException.instance().put("invalid subnet format, missing '/': ").put(sequence);
2095 }
2096
2097 int netmaskBits = parseInt0(sequence, delim + 1, sequence.length());
2098 return pack(parseSubnet0(sequence, 0, delim, netmaskBits), toNetMask(netmaskBits));
2099 }
2100
2101 // test whether the subnet matches the netmaskLength (according to postgres rules)
2102 // throws NumericException if sequence is not a valid subnet OR the subnet doesn't match the netmaskLength

Callers 2

testParseSubnetMethod · 0.95
testParseSubnet1Method · 0.95

Calls 8

indexOfMethod · 0.95
instanceMethod · 0.95
parseInt0Method · 0.95
packMethod · 0.95
parseSubnet0Method · 0.95
toNetMaskMethod · 0.95
putMethod · 0.65
lengthMethod · 0.65

Tested by 2

testParseSubnetMethod · 0.76
testParseSubnet1Method · 0.76