Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
51d2834
Split the code into MessageUnpacker and NonBlockingMessageUnpacker. A…
xerial May 20, 2014
77f6a00
Fix fixarray and fixmap header econding
xerial May 20, 2014
9efb863
Add array and binary test
xerial May 20, 2014
38ded46
Add map test
xerial May 20, 2014
610354d
Catch EOFException in skip(). Compare the performacne of two skip imp…
xerial May 20, 2014
c4c0bc6
Removed polymorphic skip function because switch statement is faster
xerial May 20, 2014
0b2f524
Removed debug message
xerial May 20, 2014
bfe78f7
Add nil test
xerial May 20, 2014
5d30d6f
Implement hashCode and equals in ExtendedTypeHeader
xerial May 20, 2014
5f3a8ee
Add Closeable interface to MessagePacker
xerial May 20, 2014
78d907c
Detect valid UTF8 string in generating random strings
xerial May 20, 2014
6dce839
Fix the bit mask in readNextLength16
xerial May 20, 2014
03ff136
Fix packBigInteger to properly output integer less than 64 bit. Let u…
xerial May 20, 2014
66d93a3
Enhance comments
xerial May 21, 2014
5f5a5f7
Move property based testing into MessagePackTest
xerial May 21, 2014
e9255cc
Handle data at the buffer boundary
xerial May 21, 2014
e8e369c
Add extended type tests
xerial May 21, 2014
56256fe
Fix the behavior of ensure(n) at the buffer boundary
xerial May 21, 2014
d11af8e
Add test that unpack data at the buffer boundary
xerial May 21, 2014
fcf8ee7
Fix extra buffer switch
xerial May 21, 2014
61f075c
Run boundary test for larger data
xerial May 21, 2014
c16de8a
Fix comment
xerial May 21, 2014
8d3fa2e
Simplified the code for swithing to the extra buffer
xerial May 22, 2014
c9d8612
Add some constructors. Enhance comments
xerial May 22, 2014
1a943cf
Fix comments
xerial May 22, 2014
12a6bca
Sanitized the code
xerial May 22, 2014
bb0e31e
Add MessageUnpacker configuration
xerial May 22, 2014
6c514cc
Fixes #93: Preparing CharBuffer for unpackString
xerial May 22, 2014
32ebdb2
#91: Add comments
xerial May 22, 2014
d3e0659
Fixes #93: Prepareing ByteBuffer for encoding UTF8 string in packString
xerial May 22, 2014
364c085
#93: Flushes the decoder only when endOfInput == true
xerial May 22, 2014
5b03e4d
#93: Call CharsetEncoder.flush properly
xerial May 22, 2014
e383ac6
Add a benchmark that compares skip performance between v6 and v7
xerial May 22, 2014
7a816ab
Add read value performance comparison between v6 and v7
xerial May 22, 2014
d663913
reuse buffer
xerial May 22, 2014
bfadb34
Removed unnecessary try-catch block
xerial May 22, 2014
b0fc482
Fix comment of skipValue()
xerial May 22, 2014
e0de2b6
Rename function to ensureBuffer
xerial May 22, 2014
261e6ed
Removing final keyword from local variables since this style is not c…
xerial May 22, 2014
352fc7b
Simplfied ensure() code
xerial May 22, 2014
b0054d7
removed boxed value
xerial May 22, 2014
0c802af
Disable concurrent test execution for producing accurate benchmark re…
xerial May 22, 2014
a8354af
Fix some comments
xerial May 23, 2014
7b69122
Add README
xerial May 23, 2014
2d73708
Add jacoco and findbugs plugin.
xerial May 23, 2014
edb9623
Move a configuration parameter to MessagePack.Config
xerial May 23, 2014
ad7474b
Update README.md
xerial May 23, 2014
8f2ca85
Delete develop.md since its contents are in README
xerial May 23, 2014
c22c6f7
Lazy initializtion of encoder and decoder to decrease the initializat…
xerial May 23, 2014
21ef571
Add description of MessageUnpacker
xerial May 23, 2014
0a32e34
fix comment
xerial May 23, 2014
784f467
Insert warmup runs
xerial May 23, 2014
1555408
Always display benchmark results
xerial May 23, 2014
0cbcf66
Cleanup imports
xerial May 23, 2014
ef322bf
#101: Workaround for Android OS. Creating Unsafe instance by calling …
xerial May 26, 2014
413a28d
#101: Fix comments
xerial May 26, 2014
b4497cb
#100 Using immutable fields and a builder for Config object
xerial May 29, 2014
f1ce805
#100: Throwing EOFException when incoming data size is insufficient
xerial May 29, 2014
c0a7af1
#100: Optimize FIXINT and buffer emptiness checks
xerial May 29, 2014
9319d52
#103 Optimization for ByteArrayInputStream
xerial May 30, 2014
60f3a13
Use bufferSize argument
xerial May 30, 2014
b71b05a
Use ChannelBufferInput when FileInputStream is passed to the unpacker
xerial May 30, 2014
c963037
Added test cases for reading various types of MessageBufferInputs, an…
xerial May 30, 2014
952996e
#103: Simplified ArrayBufferInput
xerial May 30, 2014
2657f07
#100 Fixes readLen computation in unpackString
xerial Jun 2, 2014
32fa547
#100: Add a test case for pack/unpack large strings
xerial Jun 2, 2014
882abb7
#100: Add test cases of reading malformed UTF-8 strings
xerial Jun 2, 2014
0e30c43
#100: Add test cases for FIXEXT. Fix unmappable UTF8 character check
xerial Jun 2, 2014
a2adc90
#100: Add test cases to increase the code coverage from 83% to 95%
xerial Jun 2, 2014
ac0b18c
#100: Add a test for unmappable characters
xerial Jun 2, 2014
e65da3e
#104: Fix assertion condition
xerial Jun 2, 2014
ed0f7cc
#104: Applied review comments. Added some assertions. Fixed MessageBu…
xerial Jun 4, 2014
f53e5ae
Merge pull request #104 from msgpack/v07-unpack-binary
xerial Jun 4, 2014
c1cfb7f
Merge branch 'v07-unpacker' of github.com:msgpack/msgpack-java into v…
xerial Jun 4, 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
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
MessagePack for Java
===

[MessagePack](http://msgpack.org) is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller. Small integers are encoded into a single byte, and typical short strings require only one extra byte in addition to the strings themselves.

* Message Pack specification: <https://github.com/msgpack/msgpack/blob/master/spec.md>

## Quick Start

For Maven users:
```
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack-core</artifactId>
<version>0.7.0</version>
</dependency>
```

For sbt users:
```
libraryDependencies += "org.msgpack" % "msgpack-core" % "0.7.0"
```


## For Developers

msgpack-java uses [sbt](http://www.scala-sbt.org/) for building the projects. For the basic usage of sbt, see:
* [Building Java projects with sbt](http://xerial.org/blog/2014/03/24/sbt/)

### Basic sbt commands
Enter the sbt console:
```
$ ./sbt
```

Here is a list of sbt commands for daily development:
```
> ~compile # Compile source codes
> ~test:compile # Compile both source and test codes
> ~test # Run tests upon source code change
> ~test-only *MessagePackTest # Run tests in the specified class
> ~test-only *MessagePackTest -- -n prim # Run the test tagged as "prim"
> project msgpack-core # Focus on a specific project
> package # Create a jar file in the target folder of each project
> findbugs # Produce findbugs report in target/findbugs
> jacoco:cover # Report the code coverage of tests to target/jacoco folder
```

### Publishing

```
> publishLocal # Install to local .ivy2 repository
> publishM2 # Install to local .m2 Maven repository
> publishSigned # Publish GPG signed artifacts to the Sonatype repository
> sonatypeRelease # Publish to the Maven Central (It will be synched within less than 4 hours)
```

For publishing to Maven central, msgpack-java uses [sbt-sonatype](https://github.com/xerial/sbt-sonatype) plugin. Set Sonatype account information (user name and password) in the global sbt settings. To protect your password, never include this file in your project.

___$HOME/.sbt/(sbt-version)/sonatype.sbt___

```
credentials += Credentials("Sonatype Nexus Repository Manager",
"oss.sonatype.org",
"(Sonatype user name)",
"(Sonatype password)")
```

### Project Structure

```
msgpack-core # Contains packer/unpacker implementation that never uses third-party libraries
```
19 changes: 0 additions & 19 deletions develop.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package org.msgpack.core;

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

/**
* Header of extended type
* Header of the extended types
*/
public class ExtendedTypeHeader {
private final int type;
private final int length;
ExtendedTypeHeader(int type, int length) {
this.type = type;
private final int type;

ExtendedTypeHeader(int length, int type) {
checkArgument(length >= 0, String.format("length must be >= 0: %,d", length));
this.length = length;
this.type = type;
}

public int getType() {
Expand All @@ -18,4 +22,24 @@ public int getType() {
public int getLength() {
return length;
}

@Override
public int hashCode() {
return (type + 31) * 31 + length;
}

@Override
public boolean equals(Object obj) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we check whether obj is null or not?

    if (other == null) {
      return false;
    } else if(obj instanceof ExtendedTypeHeader) { 

Copy link
Member Author

Choose a reason for hiding this comment

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

null instanceof xxx returns false, so we do not need null check here:
http://stackoverflow.com/questions/2950319/is-null-check-needed-before-calling-instanceof

Copy link
Member

Choose a reason for hiding this comment

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

Thank you for the explanation! 👍

if(obj instanceof ExtendedTypeHeader) {
ExtendedTypeHeader other = (ExtendedTypeHeader) obj;
return this.type == other.type && this.length == other.length;
}
return false;
}

@Override
public String toString() {
return String.format("ExtendedTypeHeader(type:%d, length:%,d)", type, length);
}

}
Loading