@Test public void testDisableFeatureAutoCloseTarget() throws Exception { File tempFile = createTempFile(); OutputStream out = new FileOutputStream(tempFile); MessagePackFactory messagePackFactory = new MessagePackFactory(); ObjectMapper objectMapper = new ObjectMapper(messagePackFactory); objectMapper.configure(JsonGenerator.Feature.AUTO_CLOSE_TARGET, false); List<Integer> integers = Arrays.asList(1); objectMapper.writeValue(out, integers); objectMapper.writeValue(out, integers); out.close(); MessageUnpacker unpacker = MessagePack.newDefaultUnpacker(new FileInputStream(tempFile)); assertEquals(1, unpacker.unpackArrayHeader()); assertEquals(1, unpacker.unpackInt()); assertEquals(1, unpacker.unpackArrayHeader()); assertEquals(1, unpacker.unpackInt()); }
@Override public void close() throws IOException { try { flush(); } finally { if (isEnabled(Feature.AUTO_CLOSE_TARGET)) { MessagePacker messagePacker = getMessagePacker(); messagePacker.close(); } } }
MessagePackGenerator extends GeneratorBase { @Override public void close() throws IOException { try { flush(); } finally { if (isEnabled(Feature.AUTO_CLOSE_TARGET)) { MessagePacker messagePacker = getMessagePacker(); messagePacker.close(); } } } }
MessagePackGenerator extends GeneratorBase { @Override public void close() throws IOException { try { flush(); } finally { if (isEnabled(Feature.AUTO_CLOSE_TARGET)) { MessagePacker messagePacker = getMessagePacker(); messagePacker.close(); } } } MessagePackGenerator(
            int features,
            ObjectCodec codec,
            OutputStream out,
            MessagePack.PackerConfig packerConfig,
            boolean reuseResourceInGenerator); }
MessagePackGenerator extends GeneratorBase { @Override public void close() throws IOException { try { flush(); } finally { if (isEnabled(Feature.AUTO_CLOSE_TARGET)) { MessagePacker messagePacker = getMessagePacker(); messagePacker.close(); } } } MessagePackGenerator(
            int features,
            ObjectCodec codec,
            OutputStream out,
            MessagePack.PackerConfig packerConfig,
            boolean reuseResourceInGenerator); @Override void writeStartArray(); @Override void writeEndArray(); @Override void writeStartObject(); @Override void writeEndObject(); @Override void writeFieldName(String name); @Override void writeFieldName(SerializableString name); @Override void writeString(String text); @Override void writeString(char[] text, int offset, int len); @Override void writeRawUTF8String(byte[] text, int offset, int length); @Override void writeUTF8String(byte[] text, int offset, int length); @Override void writeRaw(String text); @Override void writeRaw(String text, int offset, int len); @Override void writeRaw(char[] text, int offset, int len); @Override void writeRaw(char c); @Override void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len); @Override void writeNumber(int v); @Override void writeNumber(long v); @Override void writeNumber(BigInteger v); @Override void writeNumber(double d); @Override void writeNumber(float f); @Override void writeNumber(BigDecimal dec); @Override void writeNumber(String encodedValue); @Override void writeBoolean(boolean state); @Override void writeNull(); void writeExtensionType(MessagePackExtensionType extensionType); @Override void close(); @Override void flush(); }
MessagePackGenerator extends GeneratorBase { @Override public void close() throws IOException { try { flush(); } finally { if (isEnabled(Feature.AUTO_CLOSE_TARGET)) { MessagePacker messagePacker = getMessagePacker(); messagePacker.close(); } } } MessagePackGenerator(
            int features,
            ObjectCodec codec,
            OutputStream out,
            MessagePack.PackerConfig packerConfig,
            boolean reuseResourceInGenerator); @Override void writeStartArray(); @Override void writeEndArray(); @Override void writeStartObject(); @Override void writeEndObject(); @Override void writeFieldName(String name); @Override void writeFieldName(SerializableString name); @Override void writeString(String text); @Override void writeString(char[] text, int offset, int len); @Override void writeRawUTF8String(byte[] text, int offset, int length); @Override void writeUTF8String(byte[] text, int offset, int length); @Override void writeRaw(String text); @Override void writeRaw(String text, int offset, int len); @Override void writeRaw(char[] text, int offset, int len); @Override void writeRaw(char c); @Override void writeBinary(Base64Variant b64variant, byte[] data, int offset, int len); @Override void writeNumber(int v); @Override void writeNumber(long v); @Override void writeNumber(BigInteger v); @Override void writeNumber(double d); @Override void writeNumber(float f); @Override void writeNumber(BigDecimal dec); @Override void writeNumber(String encodedValue); @Override void writeBoolean(boolean state); @Override void writeNull(); void writeExtensionType(MessagePackExtensionType extensionType); @Override void close(); @Override void flush();  }