当前位置: 首页>>代码示例>>Java>>正文


Java PickleSerializer.serializeData方法代码示例

本文整理汇总了Java中net.razorvine.pyro.serializer.PickleSerializer.serializeData方法的典型用法代码示例。如果您正苦于以下问题:Java PickleSerializer.serializeData方法的具体用法?Java PickleSerializer.serializeData怎么用?Java PickleSerializer.serializeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.razorvine.pyro.serializer.PickleSerializer的用法示例。


在下文中一共展示了PickleSerializer.serializeData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPyroClassesPickle

import net.razorvine.pyro.serializer.PickleSerializer; //导入方法依赖的package包/类
@Test
public void testPyroClassesPickle() throws IOException
{
	PickleSerializer pickler = new PickleSerializer();
	PyroURI uri = new PyroURI("PYRO:[email protected]:4444");
	byte[] s = pickler.serializeData(uri);
	Object x = pickler.deserializeData(s);
	assertEquals(uri, x);

	PyroProxy proxy = new PyroProxy(uri);
	proxy.correlation_id = UUID.randomUUID();
	proxy.pyroHmacKey = "secret".getBytes();
	proxy.pyroHandshake = "apples";
	proxy.pyroAttrs = new HashSet<String>();
	proxy.pyroAttrs.add("attr1");
	proxy.pyroAttrs.add("attr2");
	s = pickler.serializeData(proxy);
	x = pickler.deserializeData(s);
	PyroProxy proxy2 = (PyroProxy) x;
	assertEquals(uri.host, proxy2.hostname);
	assertEquals(uri.objectid, proxy2.objectid);
	assertEquals(uri.port, proxy2.port);
	assertNull(proxy2.correlation_id); // correlation_id is not serialized on the proxy object")
	assertEquals(proxy.pyroHandshake, proxy2.pyroHandshake);
	assertArrayEquals(proxy.pyroHmacKey, proxy2.pyroHmacKey);
	assertEquals(2, proxy2.pyroAttrs.size());
	assertEquals(proxy.pyroAttrs, proxy2.pyroAttrs);
	
	PyroException ex = new PyroException("error");
	ex._pyroTraceback = "traceback";
	s = pickler.serializeData(ex);
	x = pickler.deserializeData(s);
	PyroException ex2 = (PyroException) x;
	assertEquals(ex.getMessage(), ex2.getMessage());
	assertEquals("traceback", ex2._pyroTraceback);
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:37,代码来源:SerializePyroTest.java

示例2: apply

import net.razorvine.pyro.serializer.PickleSerializer; //导入方法依赖的package包/类
@Override
public Object apply(WarpScriptStack stack) throws WarpScriptException {
  Object o = stack.pop();
  
  try {
    PickleSerializer serializer = new PickleSerializer();
    byte[] data = serializer.serializeData(o);
    stack.push(data);
  } catch (IOException ioe) {
    throw new WarpScriptException(ioe);
  }
  
  return stack;
}
 
开发者ID:cityzendata,项目名称:warp10-platform,代码行数:15,代码来源:TOPICKLE.java

示例3: testPyroClassesPickle

import net.razorvine.pyro.serializer.PickleSerializer; //导入方法依赖的package包/类
@Test
public void testPyroClassesPickle() throws IOException
{
	PickleSerializer pickler = new PickleSerializer();
	PyroURI uri = new PyroURI("PYRO:[email protected]:4444");
	byte[] s = pickler.serializeData(uri);
	Object x = pickler.deserializeData(s);
	assertEquals(uri, x);

	PyroProxy proxy = new PyroProxy(uri);
	proxy.correlation_id = UUID.randomUUID();
	proxy.pyroHmacKey = "secret".getBytes();
	proxy.pyroHandshake = "apples";
	proxy.pyroAttrs = new HashSet<String>();
	proxy.pyroAttrs.add("attr1");
	proxy.pyroAttrs.add("attr2");
	s = pickler.serializeData(proxy);
	x = pickler.deserializeData(s);
	PyroProxy proxy2 = (PyroProxy) x;
	assertEquals(uri.host, proxy2.hostname);
	assertEquals(uri.objectid, proxy2.objectid);
	assertEquals(uri.port, proxy2.port);
	assertNull(proxy2.correlation_id); // correlation_id is not serialized on the proxy object")
	assertEquals(proxy.pyroHandshake, proxy2.pyroHandshake);
	assertArrayEquals(proxy.pyroHmacKey, proxy2.pyroHmacKey);
	assertEquals(2, proxy2.pyroAttrs.size());
	assertEquals(proxy.pyroAttrs, proxy2.pyroAttrs);
	
	PyroException ex = new PyroException("error");
	ex._pyroTraceback = "traceback";
	s = pickler.serializeData(ex);
	x = pickler.deserializeData(s);
	PyroException ex2 = (PyroException) x;
	assertEquals("[Pyro4.errors.PyroError] error", ex2.getMessage());
	assertEquals("traceback", ex2._pyroTraceback);
}
 
开发者ID:irmen,项目名称:Pyrolite,代码行数:37,代码来源:SerializePyroTest.java


注:本文中的net.razorvine.pyro.serializer.PickleSerializer.serializeData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。