/** * @param sb StringBuffer to be appended to * @param start Offset of first character in the range. * @param length Number of characters to send. * @return sb with the requested text appended to it */ StringBuffer getString(StringBuffer sb, int start, int length) { return getString(sb, start >>> m_chunkBits, start & m_chunkMask, length); }
/** * @param sb StringBuffer to be appended to * @param start Offset of first character in the range. * @param length Number of characters to send. * @return sb with the requested text appended to it */ StringBuffer getString(StringBuffer sb, int start, int length) { return getString(sb, start >>> m_chunkBits, start & m_chunkMask, length); }
/** * Note that this operation has been somewhat deoptimized by the shift to a * chunked array, as there is no factory method to produce a String object * directly from an array of arrays and hence a double copy is needed. * By using ensureCapacity we hope to minimize the heap overhead of building * the intermediate StringBuffer. * <p> * (It really is a pity that Java didn't design String as a final subclass * of MutableString, rather than having StringBuffer be a separate hierarchy. * We'd avoid a <strong>lot</strong> of double-buffering.) * * @return the contents of the FastStringBuffer as a standard Java string. */ public final String toString() { int length = (m_lastChunk << m_chunkBits) + m_firstFree; return getString(new StringBuffer(length), 0, 0, length).toString(); }
/** * Note that this operation has been somewhat deoptimized by the shift to a * chunked array, as there is no factory method to produce a String object * directly from an array of arrays and hence a double copy is needed. * By using ensureCapacity we hope to minimize the heap overhead of building * the intermediate StringBuffer. * <p> * (It really is a pity that Java didn't design String as a final subclass * of MutableString, rather than having StringBuffer be a separate hierarchy. * We'd avoid a <strong>lot</strong> of double-buffering.) * * @return the contents of the FastStringBuffer as a standard Java string. */ public final String toString() { int length = (m_lastChunk << m_chunkBits) + m_firstFree; return getString(new StringBuffer(length), 0, 0, length).toString(); }
m_innerFSB.getString(sb, startColumn, m_chunkSize - startColumn); else sb.append(m_array[i], startColumn, m_chunkSize - startColumn); m_innerFSB.getString(sb, startColumn, stopColumn - startColumn); else if (stopColumn > startColumn) sb.append(m_array[stopChunk], startColumn, stopColumn - startColumn);
/** * @param start Offset of first character in the range. * @param length Number of characters to send. * @return a new String object initialized from the specified range of * characters. */ public String getString(int start, int length) { int startColumn = start & m_chunkMask; int startChunk = start >>> m_chunkBits; if (startColumn + length < m_chunkMask && m_innerFSB == null) { return getOneChunkString(startChunk, startColumn, length); } return getString(new StringBuffer(length), startChunk, startColumn, length).toString(); }
/** * Create a XMLString from a FastStringBuffer. * * * @param fsb FastStringBuffer reference, which must be non-null. * @param start The start position in the array. * @param length The number of characters to read from the array. * * @return An XMLString object that wraps the FastStringBuffer reference. */ public XMLString newstr(FastStringBuffer fsb, int start, int length) { return new XMLStringDefault(fsb.getString(start, length)); }
/** * @param start Offset of first character in the range. * @param length Number of characters to send. * @return a new String object initialized from the specified range of * characters. */ public String getString(int start, int length) { int startColumn = start & m_chunkMask; int startChunk = start >>> m_chunkBits; if (startColumn + length < m_chunkMask && m_innerFSB == null) { return getOneChunkString(startChunk, startColumn, length); } return getString(new StringBuffer(length), startChunk, startColumn, length).toString(); }
/** * Sends the specified range of characters as sax Comment. * <p> * Note that, unlike sendSAXcharacters, this has to be done as a single * call to LexicalHandler#comment. * * @param ch SAX LexicalHandler object to receive the event. * @param start Offset of first character in the range. * @param length Number of characters to send. * @exception org.xml.sax.SAXException may be thrown by handler's * characters() method. */ public void sendSAXComment( org.xml.sax.ext.LexicalHandler ch, int start, int length) throws org.xml.sax.SAXException { // %OPT% Do it this way for now... String comment = getString(start, length); ch.comment(comment.toCharArray(), 0, length); }
/** * Sends the specified range of characters as sax Comment. * <p> * Note that, unlike sendSAXcharacters, this has to be done as a single * call to LexicalHandler#comment. * * @param ch SAX LexicalHandler object to receive the event. * @param start Offset of first character in the range. * @param length Number of characters to send. * @exception org.xml.sax.SAXException may be thrown by handler's * characters() method. */ public void sendSAXComment( org.xml.sax.ext.LexicalHandler ch, int start, int length) throws org.xml.sax.SAXException { // %OPT% Do it this way for now... String comment = getString(start, length); ch.comment(comment.toCharArray(), 0, length); }
m_strCache = fsb().getString(m_start, m_length);
m_strCache = fsb().getString(m_start, m_length);
/** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. * <p> * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; // ###zaj use mask to get node type String value=null; switch (nodetype) { // ###zaj todo - document nodetypes case ATTRIBUTE_NODE: nodes.readSlot(nodeHandle+1, gotslot); case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value=m_char.getString(gotslot[2], gotslot[3]); //###zaj break; case PROCESSING_INSTRUCTION_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return value; }
/** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { // ###zaj - researching nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; String value=null; switch (nodetype) { case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value= m_char.getString(gotslot[2], gotslot[3]); break; case PROCESSING_INSTRUCTION_NODE: case ATTRIBUTE_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return m_xsf.newstr( value ); }
/** * Given a node handle, return its node value. This is mostly * as defined by the DOM, but may ignore some conveniences. * <p> * * @param nodeHandle The node id. * @return String Value of this node, or null if not * meaningful for this node type. */ public String getNodeValue(int nodeHandle) { nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; // ###zaj use mask to get node type String value=null; switch (nodetype) { // ###zaj todo - document nodetypes case ATTRIBUTE_NODE: nodes.readSlot(nodeHandle+1, gotslot); case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value=m_char.getString(gotslot[2], gotslot[3]); //###zaj break; case PROCESSING_INSTRUCTION_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return value; }
/** * Get the string-value of a node as a String object * (see http://www.w3.org/TR/xpath#data-model * for the definition of a node's string-value). * * @param nodeHandle The node ID. * * @return A string object that represents the string-value of the given node. */ public XMLString getStringValue(int nodeHandle) { // ###zaj - researching nodes.readSlot(nodeHandle, gotslot); int nodetype=gotslot[0] & 0xFF; String value=null; switch (nodetype) { case TEXT_NODE: case COMMENT_NODE: case CDATA_SECTION_NODE: value= m_char.getString(gotslot[2], gotslot[3]); break; case PROCESSING_INSTRUCTION_NODE: case ATTRIBUTE_NODE: case ELEMENT_NODE: case ENTITY_REFERENCE_NODE: default: break; } return m_xsf.newstr( value ); }
/** * Returns the string value of the entire tree */ public String getStringValue() { int child = _firstch2(ROOTNODE); if (child == DTM.NULL) return EMPTY_STR; // optimization: only create StringBuffer if > 1 child if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL)) { int dataIndex = m_dataOrQName.elementAt(child); if (dataIndex >= 0) return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex + 1)); } else return getStringValueX(getDocument()); }
/** * Returns the string value of the entire tree */ public String getStringValue() { int child = _firstch2(ROOTNODE); if (child == DTM.NULL) return EMPTY_STR; // optimization: only create StringBuffer if > 1 child if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL)) { int dataIndex = m_dataOrQName.elementAt(child); if (dataIndex >= 0) return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX); else return m_chars.getString(m_data.elementAt(-dataIndex), m_data.elementAt(-dataIndex + 1)); } else return getStringValueX(getDocument()); }
return m_chars.getString(offset, length);