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:
Woodstox 6.4.0 - Source Code Files
Woodstox 6.4.0 Source Code Files are provided at the Woodstox GitHub Website.
You can download them from the "src/main/java" folder.
You can also browse Woodstox Source Code files below:
✍: FYIcenter
⏎ com/ctc/wstx/io/BranchingReaderSource.java
package com.ctc.wstx.io; import java.io.IOException; import java.io.Reader; import javax.xml.stream.XMLStreamException; import com.ctc.wstx.api.ReaderConfig; import com.ctc.wstx.util.TextBuffer; /** * Specialized input source that can "branch" input it reads; essentially * both giving out read data AND also writing it out to a Writer. *<p> * Currently this Reader is only used as the main-level Reader, to allow for * branching of internal DTD subset to a text buffer if necessary. */ public final class BranchingReaderSource extends ReaderSource { // // // Branching information TextBuffer mBranchBuffer = null; int mBranchStartOffset = 0; boolean mConvertLFs = false; /** * Flag that indicates that last char from previous buffer was * '\r', and that following '\n' (if there is one) needs to be * ignored. */ boolean mGotCR = false; public BranchingReaderSource(ReaderConfig cfg, String pubId, SystemId sysId, Reader r, boolean realClose) { /* null -> no parent, * null -> not from explicit entity (no id/name) */ super(cfg, null, null, pubId, sysId, r, realClose); } @Override public int readInto(WstxInputData reader) throws IOException, XMLStreamException { // Need to flush out branched content? if (mBranchBuffer != null) { if (mInputLast > mBranchStartOffset) { appendBranched(mBranchStartOffset, mInputLast); } mBranchStartOffset = 0; } return super.readInto(reader); } @Override public boolean readMore(WstxInputData reader, int minAmount) throws IOException, XMLStreamException { // Existing data to output to branch? if (mBranchBuffer != null) { int ptr = reader.mInputPtr; int currAmount = mInputLast - ptr; if (currAmount > 0) { if (ptr > mBranchStartOffset) { appendBranched(mBranchStartOffset, ptr); } mBranchStartOffset = 0; } } return super.readMore(reader, minAmount); } /* ////////////////////////////////////////////////// // Branching methods; used mostly to make a copy // of parsed internal subsets. ////////////////////////////////////////////////// */ public void startBranch(TextBuffer tb, int startOffset, boolean convertLFs) { mBranchBuffer = tb; mBranchStartOffset = startOffset; mConvertLFs = convertLFs; mGotCR = false; } /** * Currently this input source does not implement branching */ public void endBranch(int endOffset) { if (mBranchBuffer != null) { if (endOffset > mBranchStartOffset) { appendBranched(mBranchStartOffset, endOffset); } // Let's also make sure no branching is done from this point on: mBranchBuffer = null; } } /* ////////////////////////////////////////////////// // Internal methods ////////////////////////////////////////////////// */ private void appendBranched(int startOffset, int pastEnd) { // Main tricky thing here is just replacing of linefeeds... if (mConvertLFs) { char[] inBuf = mBuffer; /* this will also unshare() and ensure there's room for at * least one more char */ char[] outBuf = mBranchBuffer.getCurrentSegment(); int outPtr = mBranchBuffer.getCurrentSegmentSize(); // Pending \n to skip? if (mGotCR) { if (inBuf[startOffset] == '\n') { ++startOffset; } } while (startOffset < pastEnd) { char c = inBuf[startOffset++]; if (c == '\r') { if (startOffset < pastEnd) { if (inBuf[startOffset] == '\n') { ++startOffset; } } else { mGotCR = true; } c = '\n'; } // Ok, let's add char to output: outBuf[outPtr++] = c; // Need more room? if (outPtr >= outBuf.length) { outBuf = mBranchBuffer.finishCurrentSegment(); outPtr = 0; } } mBranchBuffer.setCurrentLength(outPtr); } else { mBranchBuffer.append(mBuffer, startOffset, pastEnd-startOffset); } } }
⏎ com/ctc/wstx/io/BranchingReaderSource.java
Or download all of them as a single archive file:
File name: woodstox-core-6.4.0-fyi.zip File size: 552992 bytes Release date: 2022-10-25 Download
⇒ woodstox-core-6.4.0.jar - Woodstox Core 6.4.0
⇐ What Is Woodstox XML Processing
2023-01-29, 13478👍, 0💬
Popular Posts:
Apache Log4j Core Implementation provides the functional components of the logging system. Users are...
JRE 8 deploy.jar is the JAR file for JRE 8 Java Control Panel and other deploy tools. JRE (Java Runt...
How to download and install Apache XMLBeans-2.6.0.zip? If you want to try the XMLBeans Java library,...
What Is log4j-1.2.15.jar? I got the JAR file from apache-log4j-1.2.15.zip. log4j-1.2.15.jar is the v...
HttpComponents Core Source Code Files are provided in the source package file, httpcomponents-core-5...