msgpack / msgpack-smalltalk

MessagePack serialization library for various Smalltalk dialects / msgpack.org[Smalltalk]

Home Page:http://msgpack.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

msgpack-smalltalk

MessagePack serialization library for various Smalltalk dialects.

  • Squeak
  • Pharo
  • VisualWorks
  • VA Smalltalk
  • Dolphin Smalltalk
  • GNU Smalltalk (Beta)
  • Cuis

Sources are put as Cypress for the neutral accesses from various Smalltalk dialects.

How to use

Serialization

MpMessagePack pack: <your object>

or:

<your object> messagePacked

Deserialization

MpMessagePack unpack: msgpackBytes

or:

Object fromMessagePack: msgBytes

Samples

map := Dictionary new.
map at: 'someArray' asByteArray put: #(1 2.2 #[3 4 5]).
packed := map messagePacked.
(Object fromMessagePack: packed) inspect.
writeStream := WriteStream on: ByteArray new.
encoder := MpEncoder on: writeStream.
encoder nextPut: 1.
encoder nextPut: #(2 3).
dic := Dictionary new.
dic at: 4 put: 5.
encoder nextPut: dic.
encoder nextPut: 'four' asByteArray.
bytes := encoder contents.
readStream := ReadStream on: bytes.
decoder := MpDecoder on: readStream.
[decoder atEnd] whileFalse: [
        Transcript cr; show: decoder next printString
]

How to install

Please read HowToInstall.md.

Loading the latest development version

Squeak

Installer squeaksource
    project: 'MessagePack';
    install: 'ConfigurationOfMessagePack'. 
(Smalltalk at: #ConfigurationOfMessagePack) project development load

Pharo

Metacello new
  repository: 'github://msgpack/msgpack-smalltalk/repository';
  baseline: 'MessagePack';
  load.

You might need MpTypeMapper initializeAll on new encoder/decoder-related updates.

About

MessagePack serialization library for various Smalltalk dialects / msgpack.org[Smalltalk]

http://msgpack.org/


Languages

Language:Smalltalk 100.0%