@Test public void testReadPrimitiveObjectViaObjectMapper() throws Exception { File tempFile = createTempFile(); FileOutputStream out = new FileOutputStream(tempFile); MessagePacker packer = MessagePack.newDefaultPacker(out); packer.packString("foo"); packer.packLong(Long.MAX_VALUE); packer.packDouble(3.14); byte[] bytes = {0x00, 0x11, 0x22}; packer.packBinaryHeader(bytes.length); packer.writePayload(bytes); packer.close(); FileInputStream in = new FileInputStream(tempFile); ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()); objectMapper.configure(JsonParser.Feature.AUTO_CLOSE_SOURCE, false); assertEquals("foo", objectMapper.readValue(in, new TypeReference<String>() {})); long l = objectMapper.readValue(in, new TypeReference<Long>() {}); assertEquals(Long.MAX_VALUE, l); double d = objectMapper.readValue(in, new TypeReference<Double>() {}); assertEquals(3.14, d, 0.001); byte[] bs = objectMapper.readValue(in, new TypeReference<byte[]>() {}); assertEquals(bytes.length, bs.length); assertEquals(bytes[0], bs[0]); assertEquals(bytes[1], bs[1]); assertEquals(bytes[2], bs[2]); }
@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();  }