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:
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/MergedStream.java
package com.ctc.wstx.io;
import java.io.*;
import com.ctc.wstx.api.ReaderConfig;
/**
* Simple {@link InputStream} implementation that is used to "unwind" some
* data previously read from an input stream; so that as long as some of
* that data remains, it's returned; but as long as it's read, we'll
* just use data from the underlying original stream.
* This is similar to {@link java.io.PushbackInputStream}, but here there's
* only one implicit pushback, when instance is constructed.
*/
public final class MergedStream
extends InputStream
{
final private ReaderConfig mConfig;
final private InputStream mIn;
private byte[] mData;
private int mPtr;
final private int mEnd;
public MergedStream(ReaderConfig cfg,
InputStream in, byte[] buf, int start, int end)
{
if (in == null) {
throw new IllegalArgumentException("InputStream `in` should not be `null`");
}
mConfig = cfg;
mIn = in;
mData = buf;
mPtr = start;
mEnd = end;
}
@Override
public int available() throws IOException
{
if (mData != null) {
return mEnd - mPtr;
}
return mIn.available();
}
@Override
public void close() throws IOException
{
freeMergedBuffer();
mIn.close();
}
@Override
public synchronized void mark(int readlimit) {
if (mData == null) {
mIn.mark(readlimit);
}
}
@Override
public boolean markSupported() {
// Only supports marks past the initial rewindable section...
return (mData == null) && mIn.markSupported();
}
@Override
public int read() throws IOException
{
if (mData != null) {
int c = mData[mPtr++] & 0xFF;
if (mPtr >= mEnd) {
freeMergedBuffer();
}
return c;
}
return mIn.read();
}
@Override
public int read(byte[] b) throws IOException
{
return read(b, 0, b.length);
}
@Override
public int read(byte[] b, int off, int len) throws IOException
{
if (mData != null) {
int avail = mEnd - mPtr;
if (len > avail) {
len = avail;
}
System.arraycopy(mData, mPtr, b, off, len);
mPtr += len;
if (mPtr >= mEnd) {
freeMergedBuffer();
}
return len;
}
return mIn.read(b, off, len);
}
@Override
public synchronized void reset() throws IOException
{
if (mData == null) {
mIn.reset();
}
}
@Override
public long skip(long n) throws IOException
{
long count = 0L;
if (mData != null) {
int amount = mEnd - mPtr;
if (amount > n) { // all in pushed back segment?
mPtr += (int) n;
return n;
}
freeMergedBuffer();
count += amount;
n -= amount;
}
if (n > 0) {
count += mIn.skip(n);
}
return count;
}
private void freeMergedBuffer()
{
if (mData != null) {
byte[] data = mData;
mData = null;
if (mConfig != null) {
mConfig.freeFullBBuffer(data);
}
}
}
}
⏎ com/ctc/wstx/io/MergedStream.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, ≈45🔥, 0💬
Popular Posts:
Apache Log4j 1.2 Bridge allows applications coded to use Log4j 1.2 API to use Log4j 2 instead. Bytec...
Swingx is the SwingLabs Swing Component Extensions. JAR File Size and Download Location: File name: ...
What Is poi-examples-5.2.3.jar? poi-examples-5.2.3.jar is one of the JAR files for Apache POI 5.2.3,...
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
How to download and install ojdbc11.jar for Oracle 21c? ojdbc11.jar for Oracle 21c is a Java JDBC Dr...