Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
5b27ce5
Initial commit
komamitsu Jun 14, 2014
579e43c
Prototype MessagePackGenerator
komamitsu Jun 14, 2014
99688c6
Support nested objects
komamitsu Jun 15, 2014
f97ebd8
MessagePackGenerator supports Array
komamitsu Jun 22, 2014
1d46d19
Add tests
komamitsu Jun 23, 2014
6985965
Implementing MessagePackParser and Codec
komamitsu Jun 25, 2014
c2679d3
Passed an unit test of MessagePackParser
komamitsu Jun 28, 2014
b3ba082
Fix package name and improve MessagePackParser
komamitsu Jun 29, 2014
51ade22
Fix MessagePackParser's bug on a nested object
komamitsu Jun 30, 2014
8d0b5f7
Minor refactoring
komamitsu Jun 30, 2014
7ea00f2
MessagePackParser supports Array
komamitsu Jun 30, 2014
7acda0e
Fix the bug on nested Object/Array
komamitsu Jul 1, 2014
d6508cb
Add testJsonProperty()
komamitsu Jul 2, 2014
634de6d
Refactor tests
komamitsu Jul 3, 2014
a85aef2
Support binary value
komamitsu Jul 3, 2014
14ecfde
MessagePackParser supports the serialization of binary data
komamitsu Jul 4, 2014
e65a213
Add some tests for POJO
komamitsu Jul 5, 2014
0f6ad5f
Rename test classes
komamitsu Jul 5, 2014
5058a73
Replace MessagePackParser.currentXxxxx with valueHolder
komamitsu Jul 5, 2014
8688a52
Minor refactoring
komamitsu Jul 5, 2014
944837c
[maven-release-plugin] prepare release jackson-dataformat-msgpack-0.0.1
komamitsu Jul 5, 2014
3bb9b49
[maven-release-plugin] prepare for next development iteration
komamitsu Jul 5, 2014
0616475
Add benchmark
komamitsu Jul 6, 2014
74886d0
MessagePackParser(byte[]) calls MessageUnpacker(byte[])
komamitsu Jul 12, 2014
333c0da
Add some benchmark tests
komamitsu Jul 12, 2014
d4b8e6c
Fix wrong packing in MessagePackParser.nextToken()
komamitsu Jul 13, 2014
7a7aa1a
Refactor unit tests
komamitsu Jul 13, 2014
e6f2cc9
Add maven-findbugs-plugin
komamitsu Jul 13, 2014
1fecae8
Add findbugs report and refactoring
komamitsu Jul 14, 2014
bd17525
Use MesssagePacker/Unpacker.reset()
komamitsu Jul 19, 2014
2b12e88
Update msgpack version
komamitsu Jul 25, 2014
b1cbfbf
Reuse OutputStreamBufferOutput instance in MessagePackGenerator
komamitsu Jul 28, 2014
5a52c70
Refactoring
komamitsu Aug 3, 2014
b5c0a8f
Use msgpack-core 0.7.0-M4
komamitsu Aug 16, 2014
c5d1d10
Add a test using Enum
komamitsu Aug 18, 2014
22ffc25
Minor refactoring
komamitsu Aug 18, 2014
18a1ffc
[maven-release-plugin] prepare release jackson-dataformat-msgpack-0.0.2
komamitsu Aug 18, 2014
d52c597
[maven-release-plugin] prepare for next development iteration
komamitsu Aug 18, 2014
29117ed
Update version in README
komamitsu Aug 18, 2014
ed02e59
fixes jackson-dataformat-msgpack issue #1
Sep 30, 2014
6ad50a5
Merge pull request #2 from mattcross/master
komamitsu Sep 30, 2014
81485c7
Fix the root cause of issue#1 and refactor MessagePackParser
komamitsu Sep 30, 2014
72e6636
Shorten the elapsed time of benchmark tests
komamitsu Sep 30, 2014
7d4d9b6
Improve resource release
komamitsu Oct 1, 2014
5a222d4
Support booleans
Oct 3, 2014
b536174
Merge pull request #4 from wongpat/master
komamitsu Oct 4, 2014
47dc9d6
[maven-release-plugin] prepare release jackson-dataformat-msgpack-0.0.3
komamitsu Oct 4, 2014
5d02d9a
[maven-release-plugin] prepare for next development iteration
komamitsu Oct 4, 2014
decec80
Update version in README.md
komamitsu Oct 4, 2014
ec6eeda
Add .travis.yml
komamitsu Oct 5, 2014
c30aeff
Merge branch 'master' of github.com:komamitsu/jackson-dataformat-msgpack
komamitsu Oct 5, 2014
2061241
Remove oraclejdk6 from .travis.yml
komamitsu Oct 5, 2014
f5e3f14
Add build status to README
komamitsu Oct 5, 2014
48313b9
Improve tests for boolean
komamitsu Oct 5, 2014
3038635
Update jackson-databind version
komamitsu Oct 5, 2014
26de0b0
Adjust the parameters of the benchmarks
komamitsu Oct 5, 2014
4133898
Merge branch 'master' of github.com:komamitsu/jackson-dataformat-msgpack
komamitsu Oct 5, 2014
96f9775
Improve benchmark test
komamitsu Oct 12, 2014
b1d601c
Use ParserMinimalBase as the parent of MessagePackParser to improve t…
komamitsu Oct 11, 2014
2e5d80d
Increase the number of benchmark sampling
komamitsu Oct 12, 2014
eb1aa42
Add LICENSE file
komamitsu Oct 24, 2014
1386da9
Add 'msgpack-jackson/' from commit 'eb1aa42d9017447563df3f54095fe1603…
komamitsu Nov 9, 2014
941419d
Add the build configuration of msgpack-jackson
komamitsu Nov 9, 2014
3f82776
Suppress warnings of unit test code in msgpack-jackson
komamitsu Nov 9, 2014
357e507
Add 'msgpack-jackson' into 'Project Structure'
komamitsu Nov 9, 2014
4dce386
Remove msgpack-jackson/.travis.yml
komamitsu Nov 10, 2014
27567df
Refacotor Build.scala for msgpack-jackson
komamitsu Nov 10, 2014
d2b5faa
Remove warnings in MessagePackGenerator
komamitsu Nov 10, 2014
8b75906
Add msgpack-jackson/README.md
komamitsu Nov 10, 2014
6ca1176
Moved the factory methods from core.MessagePackFactory to MessagePack…
xerial Nov 11, 2014
b34c56a
Merge v07-develop
xerial Nov 11, 2014
fdd5f50
Add mitsu to TravisCI's notification list
xerial Nov 11, 2014
ed20171
Fix test cases to accept non-default MessagePack configuration
xerial Nov 11, 2014
7c95a9e
Rename package name of msgpack-jackson
komamitsu Nov 12, 2014
825e418
Merge branch 'v07-develop' into v07-add-jackson-dataformat
komamitsu Nov 12, 2014
8c50d09
Fix compile error of CursorTest
komamitsu Nov 12, 2014
a2bc049
Display stdout messages of jackson Junit tests
xerial Nov 13, 2014
a8f7922
Merge branch 'v07-add-jackson-dataformat' of github.com:msgpack/msgpa…
xerial Nov 13, 2014
fcb9ae3
Add a license header.
oza Nov 13, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ script: sbt ++$TRAVIS_SCALA_VERSION test

notifications:
email:
- muga.nishizawa@gmail.com
- ozawa.tsuyoshi@gmail.com
- leo@xerial.org
- komamitsu@gmail.com
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ For sbt users:
libraryDependencies += "org.msgpack" % "msgpack-core" % "0.7.0-p1"
```

If you want to use MessagePack through [jackson-databind](https://github.com/FasterXML/jackson-databind), you can use *jackson-dataformat-msgpack*. Please read [README](msgpack-jackson/README.md) to know how to use it.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain what is jackson-databind. For example,

You can use jackson-databind to serialize/deserialize Java objects in MessagePack format. For details, see msgpack-jackson/README.md

- [Usage examples](msgpack-core/src/main/java/org/msgpack/core/example/MessagePackExample.java)
- TODO: jackson-databind-msgpack usage

Expand Down Expand Up @@ -74,4 +75,5 @@ credentials += Credentials("Sonatype Nexus Repository Manager",

```
msgpack-core # Contains packer/unpacker implementation that never uses third-party libraries
msgpack-jackson # Contains jackson-dataformat-java implementation
```
160 changes: 156 additions & 4 deletions msgpack-core/src/main/java/org/msgpack/core/MessagePack.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,33 @@
//
// MessagePack for Java
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package org.msgpack.core;

import org.msgpack.core.buffer.ArrayBufferInput;
import org.msgpack.core.buffer.*;

import java.io.InputStream;
import java.io.OutputStream;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.WritableByteChannel;
import java.nio.charset.Charset;
import java.nio.charset.CodingErrorAction;

import static org.msgpack.core.Preconditions.checkArgument;

/**
* Includes MessagePack codes
* This class has MessagePack prefix code definitions and packer/unpacker factory methods.
*
*/
public class MessagePack {
Expand Down Expand Up @@ -93,8 +112,8 @@ public static class ConfigBuilder {
private boolean readStringAsBinary = true;
private boolean readBinaryAsString = true;

private CodingErrorAction onMalFormedInput = CodingErrorAction.REPORT;
private CodingErrorAction onUnmappableCharacter = CodingErrorAction.REPORT;
private CodingErrorAction onMalFormedInput = CodingErrorAction.REPLACE;
private CodingErrorAction onUnmappableCharacter = CodingErrorAction.REPLACE;

private int maxUnpackStringSize = Integer.MAX_VALUE;
private int stringEncoderBufferSize = 8192;
Expand Down Expand Up @@ -239,4 +258,137 @@ public static final boolean isFixedRaw(byte b) {
public static final byte NEGFIXINT_PREFIX = (byte) 0xe0;
}

// Packer/Unpacker factory methods

private final MessagePack.Config config;

public MessagePack() {
this(MessagePack.DEFAULT_CONFIG);
}

public MessagePack(MessagePack.Config config) {
this.config = config;
}

/**
* Default MessagePack packer/unpacker factory
*/
public static final MessagePack DEFAULT = new MessagePack(MessagePack.DEFAULT_CONFIG);


/**
* Create a MessagePacker that outputs the packed data to the specified stream, using the default configuration
* @param out
* @return
*/
public static MessagePacker newDefaultPacker(OutputStream out) {
return DEFAULT.newPacker(out);
}

/**
* Create a MessagePacker that outputs the packed data to the specified channel, using the default configuration
* @param channel
* @return
*/
public static MessagePacker newDefaultPacker(WritableByteChannel channel) {
return DEFAULT.newPacker(channel);
}

/**
* Create a MessageUnpacker that reads data from then given InputStream, using the default configuration
* @param in
* @return
*/
public static MessageUnpacker newDefaultUnpacker(InputStream in) {
return DEFAULT.newUnpacker(in);
}

/**
* Create a MessageUnpacker that reads data from the given channel, using the default configuration
* @param channel
* @return
*/
public static MessageUnpacker newDefaultUnpacker(ReadableByteChannel channel) {
return DEFAULT.newUnpacker(channel);
}

/**
* Create a MessageUnpacker that reads data from the given byte array, using the default configuration
* @param arr
* @return
*/
public static MessageUnpacker newDefaultUnpacker(byte[] arr) {
return DEFAULT.newUnpacker(arr);
}

/**
* Create a MessageUnpacker that reads data form the given byte array [offset, .. offset+length), using the default
* configuration.
* @param arr
* @param offset
* @param length
* @return
*/
public static MessageUnpacker newDefaultUnpacker(byte[] arr, int offset, int length) {
return DEFAULT.newUnpacker(arr, offset, length);
}


/**
* Create a MessagePacker that outputs the packed data to the specified stream
* @param out
*/
public MessagePacker newPacker(OutputStream out) {
return new MessagePacker(new OutputStreamBufferOutput(out), config);
}

/**
* Create a MessagePacker that outputs the packed data to the specified channel
* @param channel
*/
public MessagePacker newPacker(WritableByteChannel channel) {
return new MessagePacker(new ChannelBufferOutput(channel), config);
}

/**
* Create a MessageUnpacker that reads data from the given InputStream.
* For reading data efficiently from byte[], use {@link MessageUnpacker(byte[])} or {@link MessageUnpacker(byte[], int, int)} instead of this constructor.
*
* @param in
*/
public MessageUnpacker newUnpacker(InputStream in) {
return new MessageUnpacker(InputStreamBufferInput.newBufferInput(in), config);
}

/**
* Create a MessageUnpacker that reads data from the given ReadableByteChannel.
* @param in
*/
public MessageUnpacker newUnpacker(ReadableByteChannel in) {
return new MessageUnpacker(new ChannelBufferInput(in), config);
}


/**
* Create a MessageUnpacker that reads data from the given byte array.
*
* @param arr
*/
public MessageUnpacker newUnpacker(byte[] arr) {
return new MessageUnpacker(new ArrayBufferInput(arr), config);
}

/**
* Create a MessageUnpacker that reads data from the given byte array [offset, offset+length)
* @param arr
* @param offset
* @param length
*/
public MessageUnpacker newUnpacker(byte[] arr, int offset, int length) {
return new MessageUnpacker(new ArrayBufferInput(arr, offset, length), config);
}




}
112 changes: 0 additions & 112 deletions msgpack-core/src/main/java/org/msgpack/core/MessagePackFactory.java

This file was deleted.

Loading