项目作者: msgpack

项目描述 :
MessagePack serialization library for various Smalltalk dialects / msgpack.org[Smalltalk]
高级语言: Smalltalk
项目地址: git://github.com/msgpack/msgpack-smalltalk.git
创建时间: 2012-07-18T06:39:10Z
项目社区:https://github.com/msgpack/msgpack-smalltalk

开源协议:

下载


msgpack-smalltalk

CI

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

  1. MpMessagePack pack: <your object>

or:

  1. <your object> messagePacked

Deserialization

  1. MpMessagePack unpack: msgpackBytes

or:

  1. Object fromMessagePack: msgBytes

Samples

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

How to install

Please read HowToInstall.md.

Loading the latest development version

Squeak 4

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

Pharo & Squeak 5+

  1. Metacello new
  2. baseline: 'MessagePack';
  3. repository: 'github://msgpack/msgpack-smalltalk:develop/repository';
  4. load.

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

Limitation on Squeak 5+

Starting with Squeak 5 and 6, DateAndTime only supports microsecond precision. Because of this, nanosecond values are not properly decoded as DateAndTime.
Two unit tests (testPackUnpackTimestamp64, 96) fail on Squeak 5 and 6.