Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (309)
Collections:
Other Resources:
Jackson Core Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Core Source Code files are provided in the source packge (jackson-core-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Core Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/core/util/DefaultIndenter.java
package com.fasterxml.jackson.core.util; import java.io.IOException; import com.fasterxml.jackson.core.JsonGenerator; /** * Default linefeed-based indenter, used by {@link DefaultPrettyPrinter} (unless * overridden). Uses system-specific linefeeds and 2 spaces for indentation per level. * * @since 2.5 */ public class DefaultIndenter extends DefaultPrettyPrinter.NopIndenter { private static final long serialVersionUID = 1L; public final static String SYS_LF; static { String lf; try { lf = System.getProperty("line.separator"); } catch (Throwable t) { lf = "\n"; // fallback when security manager denies access } SYS_LF = lf; } public static final DefaultIndenter SYSTEM_LINEFEED_INSTANCE = new DefaultIndenter(" ", SYS_LF); /** * We expect to rarely get indentation deeper than this number of levels, * and try not to pre-generate more indentations than needed. */ private final static int INDENT_LEVELS = 16; private final char[] indents; private final int charsPerLevel; private final String eol; /** * Indent with two spaces and the system's default line feed */ public DefaultIndenter() { this(" ", SYS_LF); } /** * Create an indenter which uses the <code>indent</code> string to indent one level * and the <code>eol</code> string to separate lines. * * @param indent Indentation String to prepend for a single level of indentation * @param eol End-of-line marker to use after indented line */ public DefaultIndenter(String indent, String eol) { charsPerLevel = indent.length(); indents = new char[indent.length() * INDENT_LEVELS]; int offset = 0; for (int i=0; i<INDENT_LEVELS; i++) { indent.getChars(0, indent.length(), indents, offset); offset += indent.length(); } this.eol = eol; } public DefaultIndenter withLinefeed(String lf) { if (lf.equals(eol)) { return this; } return new DefaultIndenter(getIndent(), lf); } public DefaultIndenter withIndent(String indent) { if (indent.equals(getIndent())) { return this; } return new DefaultIndenter(indent, eol); } @Override public boolean isInline() { return false; } @Override public void writeIndentation(JsonGenerator jg, int level) throws IOException { jg.writeRaw(eol); if (level > 0) { // should we err on negative values (as there's some flaw?) level *= charsPerLevel; while (level > indents.length) { // unlike to happen but just in case jg.writeRaw(indents, 0, indents.length); level -= indents.length; } jg.writeRaw(indents, 0, level); } } public String getEol() { return eol; } public String getIndent() { return new String(indents, 0, charsPerLevel); } }
⏎ com/fasterxml/jackson/core/util/DefaultIndenter.java
Or download all of them as a single archive file:
File name: jackson-core-2.14.0-sources.jar File size: 497693 bytes Release date: 2022-11-05 Download
⇒ Download and Install Jackson Binary Package
2016-02-03, 48437👍, 1💬
Popular Posts:
What Is jaxb-api-2.1.6.jar? Java Architecture for XML Binding (JAXB) is a Java API that allows Java ...
What is the sax\Writer.java provided in the Apache Xerces package? I have Apache Xerces 2.11.0 insta...
Jetty provides an HTTP server, HTTP client, and javax.servlet container. These components are open s...
JDK 11 java.management.jmod is the JMOD file for JDK 11 Management module. JDK 11 Management module ...
JDK 6 tools.jar is the JAR file for JDK 6 tools. It contains Java classes to support different JDK t...