@Test public void testFloatKey() throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); MessagePacker messagePacker = MessagePack.newDefaultPacker(out).packMapHeader(2); for (int i = 0; i < 2; i++) { messagePacker.packFloat(i).packInt(i + 10); } messagePacker.close(); ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); SimpleModule module = new SimpleModule(); module.addKeyDeserializer(Float.class, new KeyDeserializer() { @Override public Object deserializeKey(String key, DeserializationContext ctxt) throws IOException, JsonProcessingException { return Float.valueOf(key); } }); objectMapper.registerModule(module); Map<Float, Integer> map = objectMapper.readValue( out.toByteArray(), new TypeReference<Map<Float, Integer>>() {}); assertEquals(2, map.size()); assertEquals((Integer) 10, map.get(0f)); assertEquals((Integer) 11, map.get(1f)); }
@Override public void close() throws IOException { try { if (isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { MessageUnpacker messageUnpacker = getMessageUnpacker(); messageUnpacker.close(); } } finally { isClosed = true; } }
MessagePackParser extends ParserMinimalBase { @Override public void close() throws IOException { try { if (isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { MessageUnpacker messageUnpacker = getMessageUnpacker(); messageUnpacker.close(); } } finally { isClosed = true; } } }
MessagePackParser extends ParserMinimalBase { @Override public void close() throws IOException { try { if (isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { MessageUnpacker messageUnpacker = getMessageUnpacker(); messageUnpacker.close(); } } finally { isClosed = true; } } MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, InputStream in);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            InputStream in,
            boolean reuseResourceInParser);  MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, byte[] bytes);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            byte[] bytes,
            boolean reuseResourceInParser); private  MessagePackParser(IOContext ctxt,
            int features,
            MessageBufferInput input,
            ObjectCodec objectCodec,
            Object src,
            boolean reuseResourceInParser); }
MessagePackParser extends ParserMinimalBase { @Override public void close() throws IOException { try { if (isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { MessageUnpacker messageUnpacker = getMessageUnpacker(); messageUnpacker.close(); } } finally { isClosed = true; } } MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, InputStream in);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            InputStream in,
            boolean reuseResourceInParser);  MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, byte[] bytes);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            byte[] bytes,
            boolean reuseResourceInParser); private  MessagePackParser(IOContext ctxt,
            int features,
            MessageBufferInput input,
            ObjectCodec objectCodec,
            Object src,
            boolean reuseResourceInParser); void setExtensionTypeCustomDeserializers(ExtensionTypeCustomDeserializers extTypeCustomDesers); @Override ObjectCodec getCodec(); @Override void setCodec(ObjectCodec c); @Override Version version(); @Override JsonToken nextToken(); @Override String getText(); @Override char[] getTextCharacters(); @Override boolean hasTextCharacters(); @Override int getTextLength(); @Override int getTextOffset(); @Override byte[] getBinaryValue(Base64Variant b64variant); @Override Number getNumberValue(); @Override int getIntValue(); @Override long getLongValue(); @Override BigInteger getBigIntegerValue(); @Override float getFloatValue(); @Override double getDoubleValue(); @Override BigDecimal getDecimalValue(); @Override Object getEmbeddedObject(); @Override NumberType getNumberType(); @Override void close(); @Override boolean isClosed(); @Override JsonStreamContext getParsingContext(); @Override JsonLocation getTokenLocation(); @Override JsonLocation getCurrentLocation(); @Override void overrideCurrentName(String name); @Override String getCurrentName(); }
MessagePackParser extends ParserMinimalBase { @Override public void close() throws IOException { try { if (isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) { MessageUnpacker messageUnpacker = getMessageUnpacker(); messageUnpacker.close(); } } finally { isClosed = true; } } MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, InputStream in);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            InputStream in,
            boolean reuseResourceInParser);  MessagePackParser(IOContext ctxt, int features, ObjectCodec objectCodec, byte[] bytes);  MessagePackParser(
            IOContext ctxt,
            int features,
            ObjectCodec objectCodec,
            byte[] bytes,
            boolean reuseResourceInParser); private  MessagePackParser(IOContext ctxt,
            int features,
            MessageBufferInput input,
            ObjectCodec objectCodec,
            Object src,
            boolean reuseResourceInParser); void setExtensionTypeCustomDeserializers(ExtensionTypeCustomDeserializers extTypeCustomDesers); @Override ObjectCodec getCodec(); @Override void setCodec(ObjectCodec c); @Override Version version(); @Override JsonToken nextToken(); @Override String getText(); @Override char[] getTextCharacters(); @Override boolean hasTextCharacters(); @Override int getTextLength(); @Override int getTextOffset(); @Override byte[] getBinaryValue(Base64Variant b64variant); @Override Number getNumberValue(); @Override int getIntValue(); @Override long getLongValue(); @Override BigInteger getBigIntegerValue(); @Override float getFloatValue(); @Override double getDoubleValue(); @Override BigDecimal getDecimalValue(); @Override Object getEmbeddedObject(); @Override NumberType getNumberType(); @Override void close(); @Override boolean isClosed(); @Override JsonStreamContext getParsingContext(); @Override JsonLocation getTokenLocation(); @Override JsonLocation getCurrentLocation(); @Override void overrideCurrentName(String name); @Override String getCurrentName();  }