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


Java SerializerUtil.serializeECReportsPretty方法代碼示例

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


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

示例1: dataReceived

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
/**
 * This method is invoked if the ReportHandler receives reports
 * 
 * @param reports the ec reports which were received
 */
public void dataReceived(ECReports reports) {
	try {
		CharArrayWriter writer = new CharArrayWriter();
		SerializerUtil.serializeECReportsPretty(reports, writer);
		ecReportArea.append(writer.toString());
		ecReportArea.append("\n\n");
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:16,代碼來源:ReportHandlerListenerGUI.java

示例2: dataReceived

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
/**
 * This method is invoked if the ReportHandler receives reports
 * 
 * @param reports the ec reports which were received
 */
public void dataReceived(ECReports reports) {
	try {
		CharArrayWriter writer = new CharArrayWriter();
		SerializerUtil.serializeECReportsPretty(reports, writer);
		if (m_accept.isSelected())
		{
			String key = (m_index++) + "-" + reports.getALEID() + "-" + reports.getSpecName();
			ecReports.put(key, reports);
			m_listModel.addElement(key);
			if (m_update.isSelected())
			{
				m_ecReportArea.setText(writer.toString());
				m_list.setSelectedIndex(0);
			}
			else
			{
				// fix for multiple elements autoselected if 0-th element clicked...
				if (m_list.getSelectedIndices().length > 1)
				{
					m_list.setSelectedIndex(1);
				}
			}
			
		}
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
開發者ID:Auto-ID-Lab-Japan,項目名稱:fosstrak-fc,代碼行數:34,代碼來源:EventSink.java

示例3: testSerializeECReportsPretty

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

示例4: test_T4

import org.fosstrak.ale.util.SerializerUtil; //導入方法依賴的package包/類
@Test
public void test_T4() throws Exception {
	TMFixedFieldListSpec tmspec = (TMFixedFieldListSpec) DeserializerUtil.deserializeTMSpec(getClass().getResourceAsStream("/tmspecs/TMFixedFieldListSpec_T4.xml"));
	ECSpec ecspec = (ECSpec) DeserializerUtil.deserializeECSpec(getClass().getResourceAsStream("/ecspecs/ECSpec_T4.xml"));
	
	//System.out.println(ecspec.getReportSpecs().getReportSpec().get(0).getFilterSpec().getExtension().getFilterList().getFilter().get(0).getFieldspec().getFieldname());
	
	// step 1
	aletm.defineTMSpec("TM1", tmspec);
	
	// step 2
	Assert.assertEquals("TM1", aletm.getTMSpecNames().get(0));
	
	// step 3
	ale.define("EC1", ecspec);
	
	// step 4
	ECReports ecreports = ale.poll("EC1");
	
	// step 5
	ECReports expectedEcreports = DeserializerUtil.deserializeECReports(getClass().getResourceAsStream("/ecreports/ECReports_T4.xml"));
	StringWriter expectedSw = new StringWriter();
	SerializerUtil.serializeECReportsPretty(expectedEcreports, expectedSw);
	String outExpectedString = expectedSw.toString();
	
	StringWriter sw = new StringWriter();
	SerializerUtil.serializeECReportsPretty(ecreports, sw);
	String outString = sw.toString();
	
	//SerializerUtil.serializeECReportsPretty(ecreports, new OutputStreamWriter(System.out));
	
	//Assert.assertEquals(expectedEcreports, ecreports);
	Assert.assertEquals(outExpectedString.substring(outExpectedString.indexOf("<reports>")), outString.substring(outString.indexOf("<reports>")));
	
	// step 6
	ale.undefine("EC1");
	
	// step 7
	aletm.undefineTMSpec("TM1");
	
	// step 8
	boolean successFlag = true;
	try {
		ale.define("EC1", ecspec);
		successFlag = true;
	} catch(ECSpecValidationException e) {
		successFlag = false;
	} finally {
		if(successFlag) Assert.fail();
	}
	
	
}
 
開發者ID:gs1oliot,項目名稱:oliot-fc,代碼行數:54,代碼來源:ALETMConformanceTest.java


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