Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
Improve the perf of msgpack-jackson
  • Loading branch information
komamitsu committed Jan 5, 2025
commit 6a4e5e6effe3927790a623f58f174d041ed5d99e
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ public ExtensionTypeCustomDeserializers(ExtensionTypeCustomDeserializers src)

public void addCustomDeser(byte type, final Deser deser)
{
deserTable.put(type, new Deser()
{
@Override
public Object deserialize(byte[] data)
throws IOException
{
return deser.deserialize(data);
}
});
deserTable.put(type, deser);
}

public Deser getDeser(byte type)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.msgpack.jackson.dataformat;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
Expand Down Expand Up @@ -52,7 +51,7 @@ public boolean equals(Object o)
@Override
public int hashCode()
{
int result = (int) type;
int result = type;
result = 31 * result + Arrays.hashCode(data);
return result;
}
Expand All @@ -61,7 +60,7 @@ public static class Serializer extends JsonSerializer<MessagePackExtensionType>
{
@Override
public void serialize(MessagePackExtensionType value, JsonGenerator gen, SerializerProvider serializers)
throws IOException, JsonProcessingException
throws IOException
{
if (gen instanceof MessagePackGenerator) {
MessagePackGenerator msgpackGenerator = (MessagePackGenerator) gen;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import com.fasterxml.jackson.core.JsonEncoding;
import com.fasterxml.jackson.core.JsonFactory;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.io.IOContext;
import org.msgpack.core.MessagePack;
Expand Down Expand Up @@ -97,22 +96,21 @@ public JsonGenerator createGenerator(File f, JsonEncoding enc)

@Override
public JsonGenerator createGenerator(Writer w)
throws IOException
{
throw new UnsupportedOperationException();
}

@Override
public JsonParser createParser(byte[] data)
throws IOException, JsonParseException
throws IOException
{
IOContext ioContext = _createContext(data, false);
return _createParser(data, 0, data.length, ioContext);
}

@Override
public JsonParser createParser(InputStream in)
throws IOException, JsonParseException
throws IOException
{
IOContext ioContext = _createContext(in, false);
return _createParser(in, ioContext);
Expand All @@ -131,7 +129,7 @@ protected MessagePackParser _createParser(InputStream in, IOContext ctxt)

@Override
protected JsonParser _createParser(byte[] data, int offset, int len, IOContext ctxt)
throws IOException, JsonParseException
throws IOException
{
if (offset != 0 || len != data.length) {
data = Arrays.copyOfRange(data, offset, offset + len);
Expand All @@ -155,12 +153,6 @@ MessagePack.PackerConfig getPackerConfig()
return packerConfig;
}

@VisibleForTesting
boolean isReuseResourceInGenerator()
{
return reuseResourceInGenerator;
}

@VisibleForTesting
boolean isReuseResourceInParser()
{
Expand All @@ -178,4 +170,10 @@ public String getFormatName()
{
return "msgpack";
}

@Override
public boolean canHandleBinaryNatively()
{
return true;
}
}
Loading