Skip to content

Commit 8675a42

Browse files
committed
Updated README.md for showing usage
1 parent 13e5dca commit 8675a42

1 file changed

Lines changed: 57 additions & 2 deletions

File tree

README.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,62 @@ msgpack-smalltalk
33

44
MessagePack serialization library for various Smalltalk dialects.
55

6-
We are moving from [Google Code site](http://code.google.com/p/messagepack-st/). Old contents are still there.
6+
- Squeak
7+
- Pharo
8+
- VisualWorks
9+
- VA Smalltalk
10+
- Dolphin Smalltalk
11+
- GNU Smalltalk (Beta)
12+
13+
Sources are put as [Cypress](https://github.com/CampSmalltalk/Cypress/blob/master/README.md) for the neutral accesses from various Smalltalk dialects.
14+
15+
## How to use ##
16+
17+
### Serialization ###
18+
```Smalltalk
19+
MpMessagePack pack: <your object>
20+
```
21+
or:
22+
```Smalltalk
23+
<your object> messagePacked
24+
```
25+
26+
### Deserialization ###
27+
```Smalltalk
28+
MpMessagePack unpack: msgpackBytes
29+
```
30+
or:
31+
```Smalltalk
32+
Object fromMessagePack: msgBytes
33+
```
34+
35+
### Samples ###
36+
37+
```Smalltalk
38+
map := Dictionary new.
39+
map at: 'someArray' asByteArray put: #(1 2.2 #[3 4 5]).
40+
packed := map messagePacked.
41+
(Object fromMessagePack: packed) inspect.
42+
```
43+
44+
```Smalltalk
45+
writeStream := WriteStream on: ByteArray new.
46+
encoder := MpEncoder on: writeStream.
47+
encoder nextPut: 1.
48+
encoder nextPut: #(2 3).
49+
dic := Dictionary new.
50+
dic at: 4 put: 5.
51+
encoder nextPut: dic.
52+
encoder nextPut: 'four' asByteArray.
53+
bytes := encoder contents.
54+
readStream := ReadStream on: bytes.
55+
decoder := MpDecoder on: readStream.
56+
[decoder atEnd] whileFalse: [
57+
Transcript cr; show: decoder next printString
58+
]
59+
```
60+
61+
----------
62+
We are moving from [Google Code site](http://code.google.com/p/messagepack-st/). Old contents including installation guide are still there.
763

8-
Currently, we have just put a [Cypress](https://github.com/CampSmalltalk/Cypress/blob/master/README.md)-based repository for the neutral accesses from various Smalltalk dialects.
964

0 commit comments

Comments
 (0)