Skip to content

Commit bc56ce3

Browse files
committed
Add ByteBuffer example
1 parent b18fa29 commit bc56ce3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ libraryDependencies += "org.msgpack" % "msgpack-core" % "0.7.0-p1"
2222
```
2323

2424
- [Usage examples](msgpack-core/src/main/java/org/msgpack/core/example/MessagePackExample.java)
25-
25+
- TODO: jackson-databind-msgpack usage
2626

2727
## For Developers
2828

msgpack-core/src/main/java/org/msgpack/core/example/MessagePackExample.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,10 @@ public static void packer() throws IOException {
127127
.packString("yyy-yyyy");
128128

129129

130-
// [Advanced] ByteBuffer
131-
ByteBuffer.wrap(new byte[] {'b', 'i', 'n', 'a', 'r', 'y', 'd', 'a', 't', 'a'});
130+
// [Advanced] write data using ByteBuffer
131+
ByteBuffer bb = ByteBuffer.wrap(new byte[] {'b', 'i', 'n', 'a', 'r', 'y', 'd', 'a', 't', 'a'});
132+
packer.packBinaryHeader(bb.remaining());
133+
packer.writePayload(bb);
132134

133135
}
134136

0 commit comments

Comments
 (0)