Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jetlinks/coap-codec
coap编解码器
https://github.com/jetlinks/coap-codec
coap coap-codec iot mqtt udp
Last synced: 3 months ago
JSON representation
coap编解码器
- Host: GitHub
- URL: https://github.com/jetlinks/coap-codec
- Owner: jetlinks
- Created: 2019-03-14T07:34:50.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-18T10:44:42.000Z (about 5 years ago)
- Last Synced: 2024-09-29T08:41:03.606Z (3 months ago)
- Topics: coap, coap-codec, iot, mqtt, udp
- Language: Java
- Size: 60.5 KB
- Stars: 11
- Watchers: 14
- Forks: 29
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# coap-codec
coap编解码器
[![Maven Central](https://img.shields.io/maven-central/v/org.jetlinks/coap-codec.svg)](http://search.maven.org/#search%7Cga%7C1%7Ccoap-codec)```java
//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();```