本文整理汇总了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;
}
示例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;
}
示例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;
}