/** * Is the buffer a representation of a fragment of an XML infoset. * * @return * <code>true</code> if the buffer is a representation of a fragment * of an XML infoset. */ public final boolean isFragment() { return (isCreated() && (_structure.getArray()[_structurePtr] & AbstractCreatorProcessor.TYPE_MASK) != AbstractCreatorProcessor.T_DOCUMENT); }
/** * @deprecated * Use {@link #setBuffer(XMLStreamBuffer, boolean)} */ protected final void setBuffer(XMLStreamBuffer buffer) { setBuffer(buffer,buffer.isFragment()); } protected final void setBuffer(XMLStreamBuffer buffer, boolean fragmentMode) {
/** * The default XMLStreamBufferResult constructor. * * <p> * A {@link MutableXMLStreamBuffer} is instantiated and used. */ public XMLStreamBufferResult() { setXMLStreamBuffer(new MutableXMLStreamBuffer()); }
public XMLStreamReader readHeader() throws XMLStreamException { if(infoset==null) { MutableXMLStreamBuffer buffer = new MutableXMLStreamBuffer(); writeTo(buffer.createFromXMLStreamWriter()); infoset = buffer; } return infoset.readAsXMLStreamReader(); }
/** * @deprecated * Use {@link #writeTo(ContentHandler,boolean)} */ public final void writeTo(ContentHandler handler) throws SAXException { writeTo(handler,isFragment()); }
private static MutableXMLStreamBuffer createXMLStreamBuffer() { // TODO: Decode should own one MutableXMLStreamBuffer for reuse // since it is more efficient. ISSUE: possible issue with // lifetime of information in the buffer if accessed beyond // the pipe line. return new MutableXMLStreamBuffer(); }
protected final void resizeStructureStrings() { _structureStringsPtr = 0; if (_currentStructureStringFragment.getNext() != null) { _currentStructureStringFragment = _currentStructureStringFragment.getNext(); _structureStrings = _currentStructureStringFragment.getArray(); } else { _structureStrings = new String[_structureStrings.length]; _currentStructureStringFragment = new FragmentedArray(_structureStrings, _currentStructureStringFragment); } }
/** * Reads the header as a {@link XMLStreamReader} */ public XMLStreamReader readHeader() throws XMLStreamException { return _mark.readAsXMLStreamReader(); }
protected final String readStructureString() { if (_structureStringsPtr < _structureStrings.length) { return _structureStrings[_structureStringsPtr++]; } _structureStringsPtr = 1; _currentStructureStringFragment = _currentStructureStringFragment.getNext(); _structureStrings = _currentStructureStringFragment.getArray(); return _structureStrings[0]; }
/** * Creates a {@link WSEndpointReference} from the given infoset. * The {@link XMLStreamReader} must point to either a document or an element. */ public WSEndpointReference(XMLStreamReader in, AddressingVersion version) throws XMLStreamException { this(XMLStreamBuffer.createNewBufferFromXMLStreamReader(in), version); }
/** * XMLStreamBufferResult constructor. * * @param buffer the {@link MutableXMLStreamBuffer} to use. */ public XMLStreamBufferResult(MutableXMLStreamBuffer buffer) { setXMLStreamBuffer(buffer); }
protected final void storeContentObject(Object s) { _contentObjects[_contentObjectsPtr++] = s; if (_contentObjectsPtr == _contentObjects.length) { resizeContentObjects(); } }
protected final int readStructure() { if (_structurePtr < _structure.length) { return _structure[_structurePtr++] & 255; } return readFromNextStructure(1); }
protected final void storeStructure(int b) { _structure[_structurePtr++] = (byte)b; if (_structurePtr == _structure.length) { resizeStructure(); } }
FragmentedArray(T item, FragmentedArray<T> previous) { setArray(item); if (previous != null) { previous._next = this; _previous = previous; } }
protected final void resizeContentCharacters() { _contentCharactersBufferPtr = 0; if (_currentContentCharactersBufferFragment.getNext() != null) { _currentContentCharactersBufferFragment = _currentContentCharactersBufferFragment.getNext(); _contentCharactersBuffer = _currentContentCharactersBufferFragment.getArray(); } else { _contentCharactersBuffer = new char[_contentCharactersBuffer.length]; _currentContentCharactersBufferFragment = new FragmentedArray(_contentCharactersBuffer, _currentContentCharactersBufferFragment); } }
/** * Is the buffer a representation of a fragment of an XML infoset * that is an element (and its contents). * * @return * <code>true</code> if the buffer a representation * of a fragment of an XML infoset that is an element (and its contents). */ public final boolean isElementFragment() { return (isCreated() && (_structure.getArray()[_structurePtr] & AbstractCreatorProcessor.TYPE_MASK) == AbstractCreatorProcessor.T_ELEMENT); }
protected final void resizeStructure() { _structurePtr = 0; if (_currentStructureFragment.getNext() != null) { _currentStructureFragment = _currentStructureFragment.getNext(); _structure = _currentStructureFragment.getArray(); } else { _structure = new byte[_structure.length]; _currentStructureFragment = new FragmentedArray(_structure, _currentStructureFragment); } }
protected final int readContentCharactersBuffer(int length) { if (_contentCharactersBufferPtr + length < _contentCharactersBuffer.length) { final int start = _contentCharactersBufferPtr; _contentCharactersBufferPtr += length; return start; } _contentCharactersBufferPtr = length; _currentContentCharactersBufferFragment = _currentContentCharactersBufferFragment.getNext(); _contentCharactersBuffer = _currentContentCharactersBufferFragment.getArray(); return 0; }