當前位置: 首頁>>代碼示例>>Java>>正文


Java SerializerUtil.serializeLRSpec方法代碼示例

本文整理匯總了Java中org.fosstrak.ale.util.SerializerUtil.serializeLRSpec方法的典型用法代碼示例。如果您正苦於以下問題:Java SerializerUtil.serializeLRSpec方法的具體用法?Java SerializerUtil.serializeLRSpec怎麽用?Java SerializerUtil.serializeLRSpec使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.fosstrak.ale.util.SerializerUtil的用法示例。


在下文中一共展示了SerializerUtil.serializeLRSpec方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: decodeResult

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Override
protected void decodeResult(StringBuffer sb, Object result) {
	if (result instanceof ArrayOfString) {
		ArrayOfString resultStringArray = (ArrayOfString)result;
		if (resultStringArray.getString().size() == 0) {
			sb.append(m_guiText.getString("EmptyArray"));
		} else {
			for (String s : resultStringArray.getString()) {
				sb.append(s);
				sb.append("\n");
			}
		}
	} else if (result instanceof LRSpec) {
		CharArrayWriter writer = new CharArrayWriter();
		try {
			SerializerUtil.serializeLRSpec((LRSpec)result, writer);
		} catch (Exception e) {
			FosstrakAleClient.instance().showExceptionDialog(m_guiText.getString("SerializationExceptionMessage"));
		}
		sb.append(writer.toString());
	}
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:23,代碼來源:ALELRClient.java

示例2: testSerializeLRSpec

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void testSerializeLRSpec() throws Exception {
	LRSpec lrSpec = createDummyLRSpec();
	CharArrayWriter writer = new CharArrayWriter();
	SerializerUtil.serializeLRSpec(lrSpec, writer);
	String str = writer.toString();
	LRSpec lrSpec2 = DeserializerUtil.deserializeLRSpec(new ByteArrayInputStream(str.getBytes()));
	ensureSame(lrSpec, lrSpec2);
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:10,代碼來源:SerializerAndDeserializerUtilsTest.java

示例3: test_L3

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void test_L3() throws Exception {
	// step 1
	LRSpec lrspec = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_1_Composite.xml"));
	alelr.define("L1", lrspec);
	
	
	// step 2
	List<String> readerNames = alelr.getLogicalReaderNames();
	assertTrue(readerNames.contains("L1"));
	
	// step 3
	List<String> lrNames = new ArrayList<String>();
	lrNames.add("limg00n_emulator");
	alelr.addReaders("L1", lrNames);
	
	
	// step 4
	LRSpec spec = alelr.getLRSpec("L1");
	//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
	
	StringWriter sw = new StringWriter();
	SerializerUtil.serializeLRSpec(spec, sw);
	String outString = sw.toString();
	
	LRSpec expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_4_Expected.xml"));
	StringWriter expectedSw = new StringWriter();
	SerializerUtil.serializeLRSpec(expected, expectedSw);
	String outExpectedString = expectedSw.toString();
	
	Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
	
	
	// step 5
	alelr.removeReaders("L1", lrNames);
	spec = alelr.getLRSpec("L1");
	//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
	
	sw = new StringWriter();
	SerializerUtil.serializeLRSpec(spec, sw);
	outString = sw.toString();
	
	expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_5_Expected.xml"));
	expectedSw = new StringWriter();
	SerializerUtil.serializeLRSpec(expected, expectedSw);
	outExpectedString = expectedSw.toString();
	
	Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
	
	
	// step 6
	alelr.setReaders("L1", lrNames);
	
	
	// step 7
	spec = alelr.getLRSpec("L1");
	//SerializerUtil.serializeLRSpec(spec, new OutputStreamWriter(System.out));
	
	sw = new StringWriter();
	SerializerUtil.serializeLRSpec(spec, sw);
	outString = sw.toString();
	
	expected = DeserializerUtil.deserializeLRSpec(ALELRConformanceTest.class.getResourceAsStream("/lrspecs/LRSpec_L3_7_Expected.xml"));
	expectedSw = new StringWriter();
	SerializerUtil.serializeLRSpec(expected, expectedSw);
	outExpectedString = expectedSw.toString();
	
	Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<isComposite>")), outString.substring(outString.indexOf("<isComposite>")));
	
	
	// step 8
	alelr.undefine("L1");
	assertTrue(!alelr.getLogicalReaderNames().contains("L1"));
}
 
開發者ID:gs1oliot,項目名稱:oliot-fc,代碼行數:75,代碼來源:ALELRConformanceTest.java


注:本文中的org.fosstrak.ale.util.SerializerUtil.serializeLRSpec方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。