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/BufferRecycler.java
package com.ctc.wstx.io;
/**
* This is a small utility class, whose main functionality is to allow
* simple reuse of raw byte/char buffers. It is usually used through
* <code>ThreadLocal</code> member of the owning class pointing to
* instance of this class through a <code>SoftReference</code>. The
* end result is a low-overhead GC-cleanable recycling: hopefully
* ideal for use by stream readers.
*<p>
* Regarding implementation: the key design goal is simplicity; and to
* that end, different types of buffers are handled separately. While
* code may look inelegant as a result (wouldn't it be neat to just
* have generic char[]/byte[] buffer accessors?), benefit is that
* no data structures are needed, just simple references. As long
* as usage pattern is well known (which it is, for stream readers)
* this should be highly optimal and robust implementation.
*/
public final class BufferRecycler
{
private volatile char[] mSmallCBuffer = null; // temp buffers
private volatile char[] mMediumCBuffer = null; // text collector
private volatile char[] mFullCBuffer = null; // for actual parsing buffer
private volatile byte[] mFullBBuffer = null;
public BufferRecycler() { }
// // // Char buffers:
// // Small buffers, for temporary parsing
public synchronized char[] getSmallCBuffer(int minSize)
{
char[] result = mSmallCBuffer;
if (result != null && result.length >= minSize) {
mSmallCBuffer = null;
return result;
}
//System.err.println("DEBUG: Alloc CSmall: "+result);
return null;
}
public synchronized void returnSmallCBuffer(char[] buffer)
{
//System.err.println("DEBUG: Return CSmall ("+buffer.length+"): "+buffer);
mSmallCBuffer = buffer;
}
// // Medium buffers, for text output collection
public synchronized char[] getMediumCBuffer(int minSize)
{
char[] result = mMediumCBuffer;
if (result != null && result.length >= minSize) {
mMediumCBuffer = null;
return result;
}
//System.err.println("DEBUG: Alloc CMed: "+result);
return null;
}
public synchronized void returnMediumCBuffer(char[] buffer)
{
mMediumCBuffer = buffer;
//System.err.println("DEBUG: Return CMed ("+buffer.length+"): "+buffer);
}
// // Full buffers, for parser buffering
public synchronized char[] getFullCBuffer(int minSize)
{
char[] result = mFullCBuffer;
if (result != null && result.length >= minSize) {
mFullCBuffer = null;
return result;
}
//System.err.println("DEBUG: Alloc CFull: "+result);
return null;
}
public synchronized void returnFullCBuffer(char[] buffer)
{
mFullCBuffer = buffer;
//System.err.println("DEBUG: Return CFull ("+buffer.length+"): "+buffer);
}
// // // Byte buffers:
// // Full byte buffers, for byte->char conversion (Readers)
public synchronized byte[] getFullBBuffer(int minSize)
{
byte[] result = mFullBBuffer;
if (result != null && result.length >= minSize) {
mFullBBuffer = null;
return result;
}
//System.err.println("DEBUG: Alloc BFull: "+result);
return null;
}
public synchronized void returnFullBBuffer(byte[] buffer)
{
mFullBBuffer = buffer;
//System.err.println("DEBUG: Return BFull ("+buffer.length+"): "+buffer);
}
}
⏎ com/ctc/wstx/io/BufferRecycler.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, ≈51🔥, 0💬
Popular Posts:
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java"....
What Is ojdbc5.jar for Oracle 11g R1? ojdbc5.jar for Oracle 11g R1 is the JAR files of ojdbc.jar, JD...
JDK 8 jconsole.jar is the JAR file for JDK 8 JConsole, which is a graphical monitoring tool to monit...
JDK 8 tools.jar is the JAR file for JDK 8 tools. It contains Java classes to support different JDK t...
maven-core-3.8.6.jar is the JAR file for Apache Maven 3.8.6 Core module. Apache Maven is a software ...