Categories:
Audio (13)
Biotech (29)
Bytecode (35)
Database (77)
Framework (7)
Game (7)
General (512)
Graphics (53)
I/O (32)
IDE (2)
JAR Tools (86)
JavaBeans (16)
JDBC (89)
JDK (337)
JSP (20)
Logging (103)
Mail (54)
Messaging (8)
Network (71)
PDF (94)
Report (7)
Scripting (83)
Security (32)
Server (119)
Servlet (17)
SOAP (24)
Testing (50)
Web (19)
XML (301)
Other Resources:
Jackson Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.12.4-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/ext/SqlBlobSerializer.java
package com.fasterxml.jackson.databind.ext; import java.io.IOException; import java.io.InputStream; import java.sql.Blob; import java.sql.SQLException; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.core.type.WritableTypeId; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer; /** * Serializer implementation for {@link java.sql.Blob} to write as binary * (for JSON and other formats Base64-encoded String, for binary formats as * true binary). * * @see com.fasterxml.jackson.databind.ser.std.ByteArraySerializer * * @since 2.12 */ @JacksonStdImpl @SuppressWarnings("serial") public class SqlBlobSerializer extends StdScalarSerializer<Blob> { public SqlBlobSerializer() { super(Blob.class); } @Override public boolean isEmpty(SerializerProvider provider, Blob value) { // Could see if "length == 0" but that might be expensive operation return (value == null); } @Override public void serialize(Blob value, JsonGenerator gen, SerializerProvider ctxt) throws IOException { _writeValue(value, gen, ctxt); } // Copied from `com.fasterxml.jackson.databind.ser.std.ByteArraySerializer` @Override public void serializeWithType(Blob value, JsonGenerator gen, SerializerProvider ctxt, TypeSerializer typeSer) throws IOException { // most likely scalar WritableTypeId typeIdDef = typeSer.writeTypePrefix(gen, typeSer.typeId(value, JsonToken.VALUE_EMBEDDED_OBJECT)); _writeValue(value, gen, ctxt); typeSer.writeTypeSuffix(gen, typeIdDef); } protected void _writeValue(Blob value, JsonGenerator gen, SerializerProvider ctxt) throws IOException { InputStream in = null; try { in = value.getBinaryStream(); } catch(SQLException e) { ctxt.reportMappingProblem(e, "Failed to access `java.sql.Blob` value to write as binary value"); } gen.writeBinary(ctxt.getConfig().getBase64Variant(), in, -1); } // Copied from `com.fasterxml.jackson.databind.ser.std.ByteArraySerializer` @Override public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException { // 08-Nov-2020, tatu: Same problem as for `byte[]`... should // make work either as String/base64, or array of numbers, // with a qualifier that can be used to determine it's byte[] JsonArrayFormatVisitor v2 = visitor.expectArrayFormat(typeHint); if (v2 != null) { v2.itemsFormat(JsonFormatTypes.INTEGER); } } }
⏎ com/fasterxml/jackson/databind/ext/SqlBlobSerializer.java
Â
⇒ Jackson Annotations Source Code
⇠Download and Install Jackson Binary Package
⇑ Downloading and Reviewing jackson-*.jar
⇑⇑ Jackson - Java JSON library
2022-03-29, 31868👍, 0💬
Popular Posts:
Where to find answers to frequently asked questions on Downloading and Installing ojdbc.jar - JDBC D...
Woodstox, Release 3.2.8 is a high-performance validating namespace-aware StAX-compliant (JSR-173) Op...
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...
The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms, it was develo...
What Is activation.jar? I heard it's related to JAF (JavaBeans Activation Framework) 1.1? The if you...