Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 525 Bytes

README.md

File metadata and controls

23 lines (15 loc) · 525 Bytes

coap-codec

coap编解码器 Maven Central

//encode
CoapPacket coapPacket = new CoapPacket();
coapPacket.setCode(Code.C205_CONTENT);
coapPacket.setPayload("{}");
coapPacket.headers().setContentFormat(MediaTypes.CT_TEXT_PLAIN);

coapPacket.writeTo(outputStream);


//decode
 CoapPacket packet = CoapPacket.deserialize(inputStream);
 
 packet.headers();
 
 packet.getPayloadString();