io.avaje.jsonb.jackson.JacksonWriteAsBytes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of avaje-jsonb-jackson Show documentation
Show all versions of avaje-jsonb-jackson Show documentation
jackson adapter for avaje-jsonb
package io.avaje.jsonb.jackson;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import io.avaje.jsonb.JsonWriter;
import io.avaje.jsonb.spi.BytesJsonWriter;
import io.avaje.jsonb.spi.DelegateJsonWriter;
final class JacksonWriteAsBytes extends DelegateJsonWriter implements BytesJsonWriter {
private final ByteArrayBuilder buffer;
JacksonWriteAsBytes(JsonWriter delegate, ByteArrayBuilder buffer) {
super(delegate);
this.buffer = buffer;
}
@Override
public byte[] result() {
delegate.close();
final byte[] result = buffer.toByteArray();
buffer.release();
return result;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy