Update index.md
This commit is contained in:
parent
e667f2b6d8
commit
a14207f421
85
index.md
85
index.md
@ -1,37 +1,80 @@
|
||||
## Welcome to GitHub Pages
|
||||
## Simple msgpack library for Java
|
||||
|
||||
You can use the [editor on GitHub](https://github.com/Dissem/MsgPack/edit/master/index.md) to maintain and preview the content for your website in Markdown files.
|
||||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ch.dissem.msgpack/msgpack/badge.svg)](https://maven-badges.herokuapp.com/maven-central/ch.dissem.msgpack/msgpack)
|
||||
[![Javadoc](https://javadoc-emblem.rhcloud.com/doc/ch.dissem.msgpack/msgpack/badge.svg)](http://www.javadoc.io/doc/ch.dissem.msgpack/msgpack)
|
||||
[![Apache 2](https://img.shields.io/badge/license-Apache_2.0-blue.svg)](https://raw.githubusercontent.com/Dissem/Jabit/master/LICENSE)
|
||||
|
||||
Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
|
||||
This is a simple Java library for handling MessagePack data. It doesn't do any object mapping, but maps to special
|
||||
objects representing MessagePack types. To build, use command `./gradlew build`.
|
||||
|
||||
### Markdown
|
||||
For most cases you might be better off using `org.msgpack:msgpack`, but I found that I needed something that generically
|
||||
represents the internal structure of the data.
|
||||
|
||||
Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
|
||||
msgpack uses Semantic Versioning, meaning as long as the major version doesn't change, nothing should break if you
|
||||
update. Be aware though that this doesn't necessarily applies for SNAPSHOT builds and the development branch.
|
||||
|
||||
```markdown
|
||||
Syntax highlighted code block
|
||||
|
||||
# Header 1
|
||||
## Header 2
|
||||
### Header 3
|
||||
#### Master
|
||||
[![Build Status](https://travis-ci.org/Dissem/MsgPack.svg?branch=master)](https://travis-ci.org/Dissem/MsgPack)
|
||||
[![Code Quality](https://img.shields.io/codacy/eb92c25247b4444383b163304e57a3ce/master.svg)](https://www.codacy.com/app/chrigu-meyer/MsgPack/dashboard?bid=4122049)
|
||||
[![Test Coverage](https://codecov.io/github/Dissem/MsgPack/coverage.svg?branch=master)](https://codecov.io/github/Dissem/MsgPack?branch=master)
|
||||
|
||||
- Bulleted
|
||||
- List
|
||||
#### Develop
|
||||
[![Build Status](https://travis-ci.org/Dissem/MsgPack.svg?branch=develop)](https://travis-ci.org/Dissem/MsgPack?branch=develop)
|
||||
[![Code Quality](https://img.shields.io/codacy/eb92c25247b4444383b163304e57a3ce/develop.svg)](https://www.codacy.com/app/chrigu-meyer/MsgPack/dashboard?bid=4118049)
|
||||
[![Test Coverage](https://codecov.io/github/Dissem/MsgPack/coverage.svg?branch=develop)](https://codecov.io/github/Dissem/MsgPack?branch=develop)
|
||||
|
||||
1. Numbered
|
||||
2. List
|
||||
### Limitations
|
||||
|
||||
**Bold** and _Italic_ and `Code` text
|
||||
* There is no fallback to BigInteger for large integer type numbers, so there might be an integer overflow when reading
|
||||
too large numbers
|
||||
* `MPFloat` uses the data type you're using to decide on precision (float 32 or 64) - not the actual value. E.g. 0.5
|
||||
could be saved perfectly as a float 42, but if you provide a double value, it will be stored as float 64, wasting
|
||||
4 bytes.
|
||||
|
||||
[Link](url) and ![Image](src)
|
||||
### Setup
|
||||
|
||||
Add msgpack as Gradle dependency:
|
||||
```Gradle
|
||||
compile "ch.dissem.msgpack:msgpack:1.0.0"
|
||||
```
|
||||
|
||||
For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).
|
||||
### Usage
|
||||
|
||||
### Jekyll Themes
|
||||
#### Serialize Data
|
||||
|
||||
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/Dissem/MsgPack/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
|
||||
First, you'll need to create some msgpack objects to serialize:
|
||||
```Java
|
||||
MPMap<MPString, MPType<?>> object = new MPMap<>();
|
||||
object.put(new MPString("compact"), new MPBoolean(true));
|
||||
object.put(new MPString("schema"), new MPInteger(0));
|
||||
```
|
||||
or the shorthand version for simple types:
|
||||
```Java
|
||||
import static ch.dissem.msgpack.types.Utils.mp;
|
||||
|
||||
### Support or Contact
|
||||
MPMap<MPString, MPType<?>> object = new MPMap<>();
|
||||
object.put(mp("compact"), mp(true));
|
||||
object.put(mp("schema"), mp(0));
|
||||
```
|
||||
then just use `pack(OutputStream)`:
|
||||
```Java
|
||||
OutputStream out = ...;
|
||||
object.pack(out);
|
||||
```
|
||||
|
||||
Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
|
||||
|
||||
#### Deserialize Data
|
||||
|
||||
For deserializing data there is the reader object:
|
||||
```Java
|
||||
Reader reader = Reader.getInstance()
|
||||
```
|
||||
just use `reader.read(InputStream)`. Unfortunately you'll need to make sure you got what you expected, the following
|
||||
example might result in `ClassCastException` at weird places:
|
||||
```Java
|
||||
InputStream in = ...;
|
||||
MPType read = reader.read(in);
|
||||
MPMap<MPString, MPString> map = (MPMap<MPString, MPString>) read;
|
||||
String value = map.get(mp("key")).getValue();
|
||||
```
|
||||
|
Loading…
Reference in New Issue
Block a user