本文整理汇总了Java中org.jgroups.util.Util.streamableFromByteBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java Util.streamableFromByteBuffer方法的具体用法?Java Util.streamableFromByteBuffer怎么用?Java Util.streamableFromByteBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.util.Util
的用法示例。
在下文中一共展示了Util.streamableFromByteBuffer方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAddress
import org.jgroups.util.Util; //导入方法依赖的package包/类
public Address getAddress() {
try {
return Util.streamableFromByteBuffer(addressClass, serializedEndpoint);
} catch (Exception e) { // NOSONAR - No choice here
throw Throwables.propagate(e);
}
}
示例2: receive
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void receive(Message msg) {
byte[] buf=msg.getRawBuffer();
if(buf == null) {
System.err.println("[" + channel.getAddress() + "] received null buffer from " + msg.getSrc() +
", headers: " + msg.printHeaders());
return;
}
try {
DrawCommand comm=(DrawCommand)Util.streamableFromByteBuffer(DrawCommand.class, buf, msg.getOffset(), msg.getLength());
switch(comm.mode) {
case DrawCommand.DRAW:
if(panel != null)
panel.drawPoint(comm);
break;
case DrawCommand.CLEAR:
clearPanel();
break;
default:
System.err.println("***** received invalid draw command " + comm.mode);
break;
}
}
catch(Exception e) {
e.printStackTrace();
}
}
示例3: onMessage
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void onMessage(Map<String, String> headers, byte[] buf, int offset, int length) {
if(buf == null)
return;
String destination=headers.get("destination");
if(destination != null && destination.equals(clients_dest)) {
String new_client=headers.get("client-joined");
if(new_client != null) {
synchronized(clients) {
if(clients.add(new_client)) {
num_clients=clients.size();
setTitle();
}
}
stomp_client.send(clients_dest, null, 0, 0, "clients", getAllClients());
}
String left_client=headers.get("client-left");
if(left_client != null) {
synchronized(clients) {
if(clients.remove(left_client)) {
num_clients=clients.size();
setTitle();
}
}
}
String all_clients=headers.get("clients");
if(all_clients != null) {
List<String> list=Util.parseCommaDelimitedStrings(all_clients);
if(list != null) {
synchronized(clients) {
if(clients.addAll(list)) {
num_clients=clients.size();
setTitle();
}
}
}
}
return;
}
try {
DrawCommand comm=(DrawCommand)Util.streamableFromByteBuffer(DrawCommand.class, buf, offset, length);
switch(comm.mode) {
case DrawCommand.DRAW:
if(panel != null)
panel.drawPoint(comm);
break;
case DrawCommand.CLEAR:
clearPanel();
break;
default:
System.err.println("***** received invalid draw command " + comm.mode);
break;
}
}
catch(Exception e) {
e.printStackTrace();
}
}
示例4: testViewId
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void testViewId() throws Exception {
byte[] buf=Util.streamableToByteBuffer(d);
Digest digest=(Digest)Util.streamableFromByteBuffer(Digest.class,buf);
System.out.println("digest = " + digest);
}