serializer - Palamecia/mint GitHub Wiki
Module serializer
Description
This module provides convenient classes for reading and writing data. It also support many standard formats like plain text, XML, JSON or YAML.
Any class of this module can be used with a print statement.
load serializer.json-stream
load system.file
if stream = Serializer.JsonStream(System.open('./target/path', 'w')) {
print (stream) {
{
'first': true,
'next': 0.5,
'last': 'foo'
}
}
}
A stream class must, at least, provide 2 methods: read and write.
It can also provides extra methods depending on the stream kind.
For byte based stream the class can provide the following methods:
readSomefor reading up to a specified amount of bytes
For text based stream the class can provide the following methods:
readCharfor reading one character after the otherreadWordfor reading one word after the otherreadUntilfor reading text until a separatorreadLinefor reading one line after the otherreadLinesto iterate over each lines
An other stream can be used to construct a stream instance. It allow to create a stream chain to provide missing features. For example, the Serializer.BufferedStream class add buffering to a classes where reading may be expensive. The Serializer.TextStream class provides a text based interface to byte based streams. An instance of this class can then be used to create a bridge between an instance of Serializer.YamlStream and a custom stream class.
Some other classes can act like a stream like System.File.
Packages
Enums
- Serializer.XmlDomException.Code
- Serializer.XmlStream.ReadElementTextBehavior
- Serializer.XmlStream.Reader.State
- Serializer.XmlStream.TokenType
Classes
- Serializer.BufferedStream
- Serializer.DataStream
- Serializer.DocumentStream
- Serializer.DocumentStream.InvalidDocument
- Serializer.JsonStream
- Serializer.JsonStream.Parser
- Serializer.StringStream
- Serializer.TextStream
- Serializer.XmlAttribute
- Serializer.XmlAttributes
- Serializer.XmlDomAttribute
- Serializer.XmlDomCData
- Serializer.XmlDomCharacterData
- Serializer.XmlDomComment
- Serializer.XmlDomDocument
- Serializer.XmlDomDocumentFragment
- Serializer.XmlDomDtd
- Serializer.XmlDomElement
- Serializer.XmlDomException
- Serializer.XmlDomNamedNodeMap
- Serializer.XmlDomNode
- Serializer.XmlDomProcessingInstruction
- Serializer.XmlDomStream
- Serializer.XmlDomStream.Context
- Serializer.XmlDomText
- Serializer.XmlSaxHandle
- Serializer.XmlSaxStream
- Serializer.XmlStream
- Serializer.XmlStream.Reader
- Serializer.XmlStream.Reader.Attribute
- Serializer.XmlStream.Reader.NamespaceDeclaration
- Serializer.XmlStream.Reader.Tag
- Serializer.XmlStream.Writer
- Serializer.YamlAlias
- Serializer.YamlComment
- Serializer.YamlDirective
- Serializer.YamlDocument
- Serializer.YamlMapping
- Serializer.YamlScalar
- Serializer.YamlSequence
- Serializer.YamlStream
- Serializer.YamlStream.Parser
- Serializer.YamlTag
- Serializer.YamlTag.InvalidTag