private void emitCarriageReturn(@NoLength char[] buf, int pos) throws SAXException { silentCarriageReturn(); flushChars(buf, pos); tokenHandler.characters(Tokenizer.LF, 0, 1); cstart = Integer.MAX_VALUE; }
/** * Returns the backing buffer. * * @return the backing buffer */ public @NoLength char[] getBuffer() { return buffer; }
private void emitPlaintextReplacementCharacter(@NoLength char[] buf, int pos) throws SAXException { flushChars(buf, pos); tokenHandler.characters(REPLACEMENT_CHARACTER, 0, 1); cstart = pos + 1; }
/** * Returns the backing buffer. * * @return the backing buffer */ public @NoLength char[] getBuffer() { return buffer; }
private void emitPlaintextReplacementCharacter(@NoLength char[] buf, int pos) throws SAXException { flushChars(buf, pos); tokenHandler.characters(REPLACEMENT_CHARACTER, 0, 1); cstart = pos + 1; }
/** * Returns the backing buffer. * * @return the backing buffer */ public @NoLength char[] getBuffer() { return buffer; }
private void emitCarriageReturn(@NoLength char[] buf, int pos) throws SAXException { silentCarriageReturn(); flushChars(buf, pos); tokenHandler.characters(Tokenizer.LF, 0, 1); cstart = Integer.MAX_VALUE; }
protected abstract void insertFosterParentedCharacters( @NoLength char[] buf, int start, int length, T table, T stackParent) throws SAXException;
/** * Receive a comment token. The data is junk if the * <code>wantsComments()</code> returned <code>false</code>. * * @param buf * a buffer holding the data * @param start the offset into the buffer * @param length * the number of code units to read * @throws SAXException * if something went wrong */ public void comment(@NoLength char[] buf, int start, int length) throws SAXException;
protected final void accumulateCharacters(@NoLength char[] buf, int start, int length) throws SAXException { System.arraycopy(buf, start, charBuffer, charBufferLen, length); charBufferLen += length; }
protected final void accumulateCharacters(@NoLength char[] buf, int start, int length) throws SAXException { System.arraycopy(buf, start, charBuffer, charBufferLen, length); charBufferLen += length; }
public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length // CPPONLY: , TreeBuilder treeBuilder, boolean maybeAtomize ) { return new String(buf, offset, length); }
private void appendStrBuf(@NoLength char[] buffer, int offset, int length) { int newLen = strBufLen + length; // CPPONLY: assert newLen <= strBuf.length: "Previous buffer length insufficient."; // CPPONLY: if (strBuf.length < newLen) { // CPPONLY: if (!EnsureBufferSpace(length)) { // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure"; // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not // CPPONLY: } System.arraycopy(buffer, offset, strBuf, strBufLen, length); strBufLen = newLen; }
private void appendStrBuf(@NoLength char[] buffer, int offset, int length) { int newLen = strBufLen + length; // CPPONLY: assert newLen <= strBuf.length: "Previous buffer length insufficient."; // CPPONLY: if (strBuf.length < newLen) { // CPPONLY: if (!EnsureBufferSpace(length)) { // CPPONLY: assert false: "RELEASE: Unable to recover from buffer reallocation failure"; // CPPONLY: } // TODO: Add telemetry when outer if fires but inner does not // CPPONLY: } System.arraycopy(buffer, offset, strBuf, strBufLen, length); strBufLen = newLen; }
public static String newStringFromBuffer(@NoLength char[] buf, int offset, int length // CPPONLY: , TreeBuilder treeBuilder, boolean maybeAtomize ) { return new String(buf, offset, length); }
protected final void accumulateCharacters(@NoLength char[] buf, int start, int length) throws SAXException { int newLen = charBufferLen + length; if (newLen > charBuffer.length) { char[] newBuf = new char[newLen]; System.arraycopy(charBuffer, 0, newBuf, 0, charBufferLen); charBuffer = null; // release the old buffer in C++ charBuffer = newBuf; } System.arraycopy(buf, start, charBuffer, charBufferLen, length); charBufferLen = newLen; }
private void appendLongStrBuf(@NoLength char[] buffer, int offset, int length) { int reqLen = longStrBufLen + length; if (longStrBuf.length < reqLen) { char[] newBuf = new char[reqLen + (reqLen >> 1)]; System.arraycopy(longStrBuf, 0, newBuf, 0, longStrBuf.length); longStrBuf = newBuf; } System.arraycopy(buffer, offset, longStrBuf, longStrBufLen, length); longStrBufLen = reqLen; }
public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int offset, int length) { if (local.length() != length) { return false; } for (int i = 0; i < length; i++) { if (local.charAt(i) != buf[offset + i]) { return false; } } return true; }
public static boolean localEqualsBuffer(@Local String local, @NoLength char[] buf, int length) { if (local.length() != length) { return false; } for (int i = 0; i < length; i++) { if (local.charAt(i) != buf[i]) { return false; } } return true; }
private final void accumulateCharactersForced(@Const @NoLength char[] buf, int start, int length) throws SAXException { System.arraycopy(buf, start, charBuffer, charBufferLen, length); charBufferLen += length; }