62,628
社区成员
发帖
与我相关
我的任务
分享
@Override
public void serialEvent(SerialPortEvent event)
{
try
{
byte[] readBuffter = new byte[1024];
InputStream vInputStream = port.getInputStream();
int len = 0;
while ((len = vInputStream.read(readBuffter)) > 0)
{
byte[] newByte = new byte[len];
System.arraycopy(readBuffter, 0, newByte, 0, len);
// 字节转16进制字符串
String str = Util.bytesToHexString(newByte);
System.out.println(str);
}
}
catch (IOException pE)
{
pE.printStackTrace();
}
}