new Encoder(dict, progressive, options)
Constructs a new PSON Encoder.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
dict |
Array.<string> |
<optional> |
Initial dictionary |
progressive |
boolean | Whether this is a progressive or a static encoder |
|
options |
Object.<string,*> |
<optional> |
Options |
Members
-
dict :Object.<string,number>
-
Dictionary hash.
-
next :number
-
Next dictionary index.
-
options :Object.<string,*>
-
Options.
-
progressive :boolean
-
Whether the encoder is progressive or static.
Methods
-
encode(json, buf) → {ByteBuffer}
-
Encodes JSON to PSON.
Parameters:
Name Type Argument Description json
* JSON
buf
(!ByteBuffer) <optional>
Buffer to encode to. When omitted, the resulting ByteBuffer will be flipped. When specified, it will not be flipped.
Returns:
PSON
- Type
- ByteBuffer