List of usage examples for com.google.common.primitives UnsignedLongs decode
public static long decode(String stringValue)
From source file:org.onosproject.incubator.net.tunnel.OpticalLogicId.java
public static OpticalLogicId logicId(String string) { return new OpticalLogicId(UnsignedLongs.decode(string)); }
From source file:org.onosproject.net.PortNumber.java
/** * Returns the port number representing the specified string value. * * @param string port number as string value * @return port number/*w w w . jav a 2s.co m*/ */ public static PortNumber portNumber(String string) { return new PortNumber(UnsignedLongs.decode(string)); }
From source file:org.openo.msb.wrapper.consul.util.UnsignedLongDeserializer.java
@Override public Long deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String sValue = jp.getValueAsString(); return UnsignedLongs.decode(sValue); }
From source file:org.onlab.packet.dhcp.CircuitId.java
/** * Deserialize circuit id from byte string. * * @param circuitId the circuit id byte string * @return a Circuit Id//from w ww .ja v a 2 s. c om */ public static CircuitId deserialize(byte[] circuitId) { String cIdString = new String(circuitId, StandardCharsets.US_ASCII); List<String> splittedCircuitId = Lists.newArrayList(cIdString.split(SEPARATOR)); checkArgument(splittedCircuitId.size() > 1, "Illegal circuit id."); // remove last element (vlan id) String vlanId = splittedCircuitId.remove(splittedCircuitId.size() - 1); // Reconstruct device Id String connectPoint = String.join(SEPARATOR, splittedCircuitId); String[] splittedConnectPoint = connectPoint.split(DEVICE_PORT_SEPARATOR); // Check connect point is valid or not checkArgument(splittedConnectPoint.length == 2, "Connect point must be in \"deviceUri/portNumber\" format"); // Check the port number is a number or not UnsignedLongs.decode(splittedConnectPoint[1]); return new CircuitId(connectPoint, VlanId.vlanId(vlanId)); }