Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
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 (322)
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/io/SegmentedStringWriter.java
package com.fasterxml.jackson.core.io;
import java.io.*;
import com.fasterxml.jackson.core.util.BufferRecycler;
import com.fasterxml.jackson.core.util.TextBuffer;
/**
* Efficient alternative to {@link StringWriter}, based on using segmented
* internal buffer. Initial input buffer is also recyclable.
*<p>
* This class is most useful when serializing JSON content as a String:
* if so, instance of this class can be given as the writer to
* <code>JsonGenerator</code>.
*/
public final class SegmentedStringWriter extends Writer
{
final private TextBuffer _buffer;
public SegmentedStringWriter(BufferRecycler br) {
super();
_buffer = new TextBuffer(br);
}
/*
/**********************************************************
/* java.io.Writer implementation
/**********************************************************
*/
@Override
public Writer append(char c) {
write(c);
return this;
}
@Override
public Writer append(CharSequence csq) {
String str = csq.toString();
_buffer.append(str, 0, str.length());
return this;
}
@Override
public Writer append(CharSequence csq, int start, int end) {
String str = csq.subSequence(start, end).toString();
_buffer.append(str, 0, str.length());
return this;
}
@Override public void close() { } // NOP
@Override public void flush() { } // NOP
@Override
public void write(char[] cbuf) { _buffer.append(cbuf, 0, cbuf.length); }
@Override
public void write(char[] cbuf, int off, int len) { _buffer.append(cbuf, off, len); }
@Override
public void write(int c) { _buffer.append((char) c); }
@Override
public void write(String str) { _buffer.append(str, 0, str.length()); }
@Override
public void write(String str, int off, int len) { _buffer.append(str, off, len); }
/*
/**********************************************************
/* Extended API
/**********************************************************
*/
/**
* Main access method that will construct a String that contains
* all the contents, release all internal buffers we may have,
* and return result String.
* Note that the method is not idempotent -- if called second time,
* will just return an empty String.
*
* @return String that contains all aggregated content
*/
public String getAndClear() {
String result = _buffer.contentsAsString();
_buffer.releaseBuffers();
return result;
}
}
⏎ com/fasterxml/jackson/core/io/SegmentedStringWriter.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, ≈109🔥, 1💬
Popular Posts:
JDK 17 jdk.javadoc.jmod is the JMOD file for JDK 17 Java Document tool, which can be invoked by the ...
How to perform XML Schema validation with dom\Writer.java provided in the Apache Xerces package? You...
The JDT project provides the tool plug-ins that implement a Java IDE supporting the development of a...
JDK 11 jdk.xml.dom.jmod is the JMOD file for JDK 11 XML DOM module. JDK 11 XML DOM module compiled c...
JDK 11 jdk.internal.le.jmod is the JMOD file for JDK 11 Internal Line Editing module. JDK 11 Interna...