Skip to content

Commit e261c59

Browse files
committed
Merge v07-develop and fix code style
1 parent b5d62da commit e261c59

File tree

17 files changed

+114
-73
lines changed

17 files changed

+114
-73
lines changed

msgpack-core/src/main/java/org/msgpack/core/MessagePack.java

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,11 @@
1515
//
1616
package org.msgpack.core;
1717

18-
import org.msgpack.core.buffer.ArrayBufferInput;
19-
import org.msgpack.core.buffer.ChannelBufferInput;
20-
import org.msgpack.core.buffer.ChannelBufferOutput;
21-
import org.msgpack.core.buffer.InputStreamBufferInput;
22-
import org.msgpack.core.buffer.OutputStreamBufferOutput;
23-
2418
import java.io.InputStream;
2519
import java.io.OutputStream;
2620
import java.nio.channels.ReadableByteChannel;
2721
import java.nio.channels.WritableByteChannel;
2822
import java.nio.charset.Charset;
29-
import java.nio.charset.CodingErrorAction;
30-
31-
import static org.msgpack.core.Preconditions.checkArgument;
3223

3324
/**
3425
* This class has MessagePack prefix code definitions and packer/unpacker factory methods.
@@ -53,7 +44,8 @@ public static MessagePackFactory getDefaultFactory()
5344
}
5445

5546
private MessagePack()
56-
{ }
47+
{
48+
}
5749

5850
/**
5951
* Equivalent to getDefaultFactory().newPacker(out).
@@ -80,7 +72,6 @@ public static MessagePacker newDefaultPacker(WritableByteChannel channel)
8072
/**
8173
* Equivalent to getDefaultFactory().newBufferPacker()
8274
*
83-
* @param channel
8475
* @return
8576
*/
8677
public static MessageBufferPacker newDefaultBufferPacker()

msgpack-core/src/main/java/org/msgpack/core/MessagePackFactory.java

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,15 @@
1919
import org.msgpack.core.buffer.ChannelBufferInput;
2020
import org.msgpack.core.buffer.ChannelBufferOutput;
2121
import org.msgpack.core.buffer.InputStreamBufferInput;
22-
import org.msgpack.core.buffer.OutputStreamBufferOutput;
2322
import org.msgpack.core.buffer.MessageBufferInput;
2423
import org.msgpack.core.buffer.MessageBufferOutput;
24+
import org.msgpack.core.buffer.OutputStreamBufferOutput;
2525

2626
import java.io.InputStream;
2727
import java.io.OutputStream;
28-
import java.nio.channels.WritableByteChannel;
2928
import java.nio.channels.ReadableByteChannel;
30-
29+
import java.nio.channels.WritableByteChannel;
3130
import java.nio.charset.CodingErrorAction;
32-
import static org.msgpack.core.Preconditions.checkArgument;
3331

3432
public class MessagePackFactory
3533
{
@@ -42,8 +40,8 @@ public class MessagePackFactory
4240
private int unpackStringSizeLimit = Integer.MAX_VALUE;
4341
private int unpackStringDecoderBufferSize = 8192;
4442

45-
private int inputBufferSize = 16*1024;
46-
private int outputBufferSize = 16*1024;
43+
private int inputBufferSize = 16 * 1024;
44+
private int outputBufferSize = 16 * 1024;
4745

4846
public MessagePacker newPacker(OutputStream out)
4947
{
@@ -58,13 +56,13 @@ public MessagePacker newPacker(WritableByteChannel channel)
5856
public MessagePacker newPacker(MessageBufferOutput output)
5957
{
6058
return new MessagePacker(output)
61-
.setSmallStringOptimizationThreshold(packerSmallStringOptimizationThreshold);
59+
.setSmallStringOptimizationThreshold(packerSmallStringOptimizationThreshold);
6260
}
6361

6462
public MessageBufferPacker newBufferPacker()
6563
{
6664
return new MessageBufferPacker()
67-
.setSmallStringOptimizationThreshold(packerSmallStringOptimizationThreshold);
65+
.setSmallStringOptimizationThreshold(packerSmallStringOptimizationThreshold);
6866
}
6967

7068
public MessageUnpacker newUnpacker(byte[] contents)
@@ -90,12 +88,12 @@ public MessageUnpacker newUnpacker(ReadableByteChannel channel)
9088
public MessageUnpacker newUnpacker(MessageBufferInput input)
9189
{
9290
return new MessageUnpacker(input)
93-
.setAllowStringAsBinary(unpackAllowStringAsBinary)
94-
.setAllowBinaryAsString(unpackAllowBinaryAsString)
95-
.setActionOnMalformedString(unpackActionOnMalformedString)
96-
.setActionOnUnmappableString(unpackActionOnUnmappableString)
97-
.setStringSizeLimit(unpackStringSizeLimit)
98-
.setStringDecoderBufferSize(unpackStringDecoderBufferSize);
91+
.setAllowStringAsBinary(unpackAllowStringAsBinary)
92+
.setAllowBinaryAsString(unpackAllowBinaryAsString)
93+
.setActionOnMalformedString(unpackActionOnMalformedString)
94+
.setActionOnUnmappableString(unpackActionOnUnmappableString)
95+
.setStringSizeLimit(unpackStringSizeLimit)
96+
.setStringDecoderBufferSize(unpackStringDecoderBufferSize);
9997
}
10098

10199
/**

msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.nio.charset.CharacterCodingException;
2828
import java.nio.charset.CharsetEncoder;
2929
import java.nio.charset.CoderResult;
30-
import java.nio.charset.CodingErrorAction;
3130

3231
import static org.msgpack.core.MessageFormat.Code.ARRAY16;
3332
import static org.msgpack.core.MessageFormat.Code.ARRAY32;

msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.msgpack.value.Variable;
2525

2626
import java.io.Closeable;
27-
import java.io.EOFException;
2827
import java.io.IOException;
2928
import java.math.BigInteger;
3029
import java.nio.ByteBuffer;
@@ -33,13 +32,11 @@
3332
import java.nio.charset.CharsetDecoder;
3433
import java.nio.charset.CoderResult;
3534
import java.nio.charset.CodingErrorAction;
36-
import java.nio.charset.MalformedInputException;
3735
import java.util.ArrayList;
3836
import java.util.HashMap;
3937
import java.util.List;
4038
import java.util.Map;
4139

42-
import static org.msgpack.core.Preconditions.checkArgument;
4340
import static org.msgpack.core.Preconditions.checkNotNull;
4441

4542
/**
@@ -1019,7 +1016,7 @@ else if (bufferRemaining == 0) {
10191016
}
10201017

10211018
private void handleCoderError(CoderResult cr)
1022-
throws CharacterCodingException
1019+
throws CharacterCodingException
10231020
{
10241021
if ((cr.isMalformed() && actionOnMalformedString == CodingErrorAction.REPORT) ||
10251022
(cr.isUnmappable() && actionOnUnmappableString == CodingErrorAction.REPORT)) {

msgpack-core/src/main/java/org/msgpack/core/buffer/ArrayBufferInput.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,4 @@ public void close()
8787
buffer = null;
8888
isRead = false;
8989
}
90-
9190
}

msgpack-core/src/main/java/org/msgpack/core/buffer/ChannelBufferInput.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,4 @@ public void close()
7878
{
7979
channel.close();
8080
}
81-
8281
}

msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBufferBE.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
//
1616
package org.msgpack.core.buffer;
1717

18-
import java.nio.ByteBuffer;
19-
2018
import static org.msgpack.core.Preconditions.checkArgument;
2119

2220
/**

msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBufferInput.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,12 @@ public interface MessageBufferInput
2626
{
2727
/**
2828
* Get a next buffer to read.
29-
*
30-
* When this method is called twice, the formally allocated buffer can be safely discarded.
29+
* <p>
30+
* When this method is called, the formally allocated buffer can be safely discarded.
3131
*
3232
* @return the next MessageBuffer, or return null if no more buffer is available.
3333
* @throws IOException when error occurred when reading the data
3434
*/
3535
public MessageBuffer next()
3636
throws IOException;
37-
3837
}

msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBufferU.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
package org.msgpack.core.buffer;
1717

1818
import java.nio.ByteBuffer;
19-
import java.nio.ByteOrder;
2019

2120
import static org.msgpack.core.Preconditions.checkArgument;
22-
import static org.msgpack.core.Preconditions.checkNotNull;
2321

2422
/**
2523
* Universal MessageBuffer implementation supporting Java6 and Android.

msgpack-core/src/main/java/org/msgpack/value/impl/ImmutableArrayValueImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ private static void appendString(StringBuilder sb, Value value)
196196
{
197197
if (value.isRawValue()) {
198198
sb.append(value.toJson());
199-
} else {
199+
}
200+
else {
200201
sb.append(value.toString());
201202
}
202203
}

0 commit comments

Comments
 (0)