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


Java IntArrayInputStream類代碼示例

本文整理匯總了Java中com.rapplogic.xbee.util.IntArrayInputStream的典型用法代碼示例。如果您正苦於以下問題:Java IntArrayInputStream類的具體用法?Java IntArrayInputStream怎麽用?Java IntArrayInputStream使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: parseIsSample

import com.rapplogic.xbee.util.IntArrayInputStream; //導入依賴的package包/類
public static ZNetRxIoSampleResponse parseIsSample(AtCommandResponse response) throws IOException {
	
	if (!response.getCommand().equals("IS")) {
		throw new RuntimeException("This is only applicable to the \"IS\" AT command");
	}
	
	IntArrayInputStream in = new IntArrayInputStream(response.getValue());
	ZNetRxIoSampleResponse sample = new ZNetRxIoSampleResponse();
	sample.parseIoSample(in);
	
	return sample;
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:13,代碼來源:ZNetRxIoSampleResponse.java

示例2: parse

import com.rapplogic.xbee.util.IntArrayInputStream; //導入依賴的package包/類
public static ZBNodeDiscover parse(AtCommandResponse response) {
	
	if (!response.getCommand().equals("ND")) {
		throw new RuntimeException("This method is only applicable for the ND command");
	}
	
	int[] data = response.getValue();
	
	IntArrayInputStream in = new IntArrayInputStream(data);
	
	ZBNodeDiscover nd = new ZBNodeDiscover();
	
	nd.setNodeAddress16(new XBeeAddress16(in.read(2)));
	
	nd.setNodeAddress64(new XBeeAddress64(in.read(8)));

	StringBuffer ni = new StringBuffer();
	
	int ch;
	
	// NI is terminated with 0
	while ((ch = in.read()) != 0) {
		if (ch < 32 || ch > 126) {
			throw new RuntimeException("Node Identifier " + ch + " is non-ascii");
		}
		
		ni.append((char)ch);	
	}
	
	nd.setNodeIdentifier(ni.toString());
			
	nd.setParent(new XBeeAddress16(in.read(2)));
	nd.setDeviceType(DeviceType.get(in.read()));
	// TODO this is being reported as 1 (router) for my end device
	nd.setStatus(in.read());
	nd.setProfileId(in.read(2));
	nd.setMfgId(in.read(2));
	
	return nd;
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:41,代碼來源:ZBNodeDiscover.java

示例3: parse

import com.rapplogic.xbee.util.IntArrayInputStream; //導入依賴的package包/類
public static WpanNodeDiscover parse(AtCommandResponse response) {
	
	if (!response.getCommand().equals("ND")) {
		throw new IllegalArgumentException("This method is only applicable for the ND command");
	}
	
	int[] data = response.getValue();
	
	if (data == null || data.length == 0) {
		throw new IllegalArgumentException("ND command has no value");
	}
	
	IntArrayInputStream in = new IntArrayInputStream(data);
	
	WpanNodeDiscover nd = new WpanNodeDiscover();
	
	nd.setNodeAddress16(new XBeeAddress16(in.read(2)));
	
	nd.setNodeAddress64(new XBeeAddress64(in.read(8)));
	
	nd.setRssi(-1*in.read());

	StringBuilder ni = new StringBuilder();
	
	int ch;
	
	// NI is terminated with 0
	while ((ch = in.read()) != 0) {
		if (ch < 32 || ch > 126) {
			throw new RuntimeException("Node Identifier " + ch + " is non-ascii");
		}
		
		ni.append((char)ch);	
	}
	
	nd.setNodeIdentifier(ni.toString());
	
	return nd;
}
 
開發者ID:andrewrapp,項目名稱:xbee-api,代碼行數:40,代碼來源:WpanNodeDiscover.java


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