public void reconstitute(ByteBuffer bb) throws IOException {
LocateLoader.deflt.unmarshal(this, toDIS(bb));
}
+
+ public Data copy() {
+ Data out = new Data();
+ out.name = name;
+ out.hostname = hostname;
+ out.port = port;
+ out.major = major;
+ out.minor = minor;
+ out.patch = patch;
+ out.pkg = pkg;
+ out.latitude = latitude;
+ out.longitude = longitude;
+ out.protocol = protocol;
+ out.subprotocol = new HashSet<>();
+ out.subprotocol.addAll(subprotocol);
+ out.port_key = port_key;
+ return out;
+ }
}
private static class LocateLoader extends Loader<Data> implements Streamer<Data>{
os.writeFloat(data.latitude);
os.writeFloat(data.longitude);
writeString(os, data.protocol);
- if(data.subprotocol==null) {
+ if (data.subprotocol==null) {
os.writeInt(0);
} else {
os.writeInt(data.subprotocol.size());
- for(String s: data.subprotocol) {
+ for (String s: data.subprotocol) {
writeString(os,s);
}
}
int size = is.readInt();
data.subprotocol = new HashSet<>(size);
- for(int i=0;i<size;++i) {
+ for (int i=0;i<size;++i) {
data.subprotocol.add(readString(is,buff));
}
String port_key = readString(is,buff);
- if(port_key.length()>0) {
+ if (port_key.length()>0) {
data.port_key=UUID.fromString(port_key);
} else {
data.port_key = null;