本文整理汇总了Java中org.jgroups.util.Util.objectToStream方法的典型用法代码示例。如果您正苦于以下问题:Java Util.objectToStream方法的具体用法?Java Util.objectToStream怎么用?Java Util.objectToStream使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jgroups.util.Util
的用法示例。
在下文中一共展示了Util.objectToStream方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream output) throws Exception {
DataOutputStream out=new DataOutputStream(new BufferedOutputStream(output, 1000));
try {
synchronized(nodes) {
Util.objectToStream(nodes, out);
}
}
finally {
Util.close(out);
}
}
示例2: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
if(get_error)
throw new RuntimeException("[dummy failure] state could not be serialized");
DataOutputStream out=new DataOutputStream(new BufferedOutputStream(ostream, 200));
Util.objectToStream(state_to_send, out);
out.flush();
}
示例3: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
OutputStream out=new BufferedOutputStream(ostream);
synchronized(map) {
Util.objectToStream(map, new DataOutputStream(out));
out.flush();
}
}
示例4: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
Util.objectToStream(stocks, new DataOutputStream(ostream));
}
示例5: objectToBuffer
import org.jgroups.util.Util; //导入方法依赖的package包/类
public Buffer objectToBuffer(Object obj) throws Exception {
ByteArrayOutputStream out_stream=new ByteArrayOutputStream(35);
DataOutputStream out=new DataOutputStream(out_stream);
try {
if(obj == null) {
out_stream.write(NULL);
out_stream.flush();
return new Buffer(out_stream.toByteArray());
}
if(obj instanceof MethodCall) {
out.writeByte(METHOD_CALL);
MethodCall call=(MethodCall)obj;
out.writeShort(call.getId());
Object[] args=call.getArgs();
if(args == null || args.length == 0) {
out.writeShort(0);
}
else {
out.writeShort(args.length);
for(int i=0; i < args.length; i++) {
Util.objectToStream(args[i], out);
}
}
}
else if(obj instanceof Cache.Value) {
Cache.Value value=(Cache.Value)obj;
out.writeByte(VALUE);
out.writeLong(value.getTimeout());
Util.objectToStream(value.getValue(), out);
}
else {
out.writeByte(OBJ);
Util.objectToStream(obj, out);
}
out.flush();
return new Buffer(out_stream.toByteArray());
}
finally {
Util.close(out);
}
}
示例6: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
Util.objectToStream(root.clone(), new DataOutputStream(ostream));
}
示例7: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
synchronized(data) {
Util.objectToStream(data, new DataOutputStream(ostream));
}
}
示例8: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream ostream) throws Exception {
synchronized(state) {
Util.objectToStream(state, new DataOutputStream(ostream));
}
}
示例9: getState
import org.jgroups.util.Util; //导入方法依赖的package包/类
public void getState(OutputStream output) throws Exception {
synchronized(state) {
Util.objectToStream(state, new DataOutputStream(output));
}
}