Skip to content

Commit

Permalink
Update data-formats.md (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdogmcsteezy authored Sep 7, 2023
1 parent cfa87e3 commit f67fb9f
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions docs/data-formats.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ Or with Java

```java
MessageBufferPacker packer=new MessagePack.PackerConfig().newBufferPacker();
String geoString="{\"coordinates\": [-122.0, 37.5], \"type\": \"Point\"}";
packer.packMapHeader(1);
packer.packString("geo_bin");
packer.packExtensionTypeHeader((byte)23,geoString.length());
packer.addPayload(geoString.getBytes("UTF-8"));
String geoString="{\"coordinates\": [-122.0, 37.5], \"type\": \"Point\"}";
packer.packMapHeader(1);
packer.packString("geo_bin");
packer.packExtensionTypeHeader((byte)23,geoString.length());
packer.addPayload(geoString.getBytes("UTF-8"));
```

Bytes are a standard Message Pack type. Here is an example of creating a Bin Map to be used with the API
Expand All @@ -95,14 +95,10 @@ Bytes are a standard Message Pack type. Here is an example of creating a Bin Map

```java
byte[]testBytes={1,2,3};
MessageBufferPacker packer=new MessagePack.PackerConfig().newBufferPacker();

packer.packMapHeader(1);

packer.packString("my_bytes");

packer.packBinaryHeader(3);
packer.writePayload(testBytes);

byte[]payload=packer.toByteArray();
```
MessageBufferPacker packer=new MessagePack.PackerConfig().newBufferPacker();
packer.packMapHeader(1);
packer.packString("my_bytes");
packer.packBinaryHeader(3);
packer.writePayload(testBytes);
byte[]payload=packer.toByteArray();
```

0 comments on commit f67fb9f

Please sign in to comment.