| | |
| | | String headString = "Topic:" + getTopic() + "\r\n" + "Length:" + dataBytes.length + "\r\n" + "\r\n";
|
| | | byte[] headBytes = headString.getBytes("utf-8");
|
| | | byte[] sendBytes = ByteUtils.concatBytes(headBytes, dataBytes);
|
| | | LogUtils.i(headString + "\r\n" + data);
|
| | | LogUtils.i("发送数据:\r\n" + headString + "\r\n" + data);
|
| | | return sendBytes;
|
| | |
|
| | | } else {
|
| | | return this.toString().getBytes("utf-8");
|
| | | String sendString = this.toString();
|
| | | LogUtils.i("发送数据:\r\n" + sendString);
|
| | | return sendString.getBytes("utf-8");
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|