com.sun.xml.stream.buffer.XMLStreamBufferMark Maven / Gradle / Ivy
Show all versions of webservices-rt Show documentation
/*
* Copyright (c) 2005, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.stream.buffer;
import java.util.Map;
/**
* A mark into a buffer.
*
*
* A mark can be processed in the same manner as a XMLStreamBuffer.
*
*
* A mark will share a sub set of information of the buffer that is
* marked. If the buffer is directly or indirectly associated with a
* (mutable) {@link XMLStreamBuffer} which is reset and/or re-created
* then this will invalidate the mark and processing behvaiour of the mark
* is undefined. It is the responsibility of the application to manage the
* relationship between the marked XMLStreamBuffer and one or more marks.
*/
public class XMLStreamBufferMark extends XMLStreamBuffer {
/**
* Create a mark from the buffer that is being created.
*
*
* A mark will be created from the current position of creation of the
* {@link XMLStreamBuffer} that is being created by a {@link AbstractCreator}.
*
* @param inscopeNamespaces
* The in-scope namespaces on the fragment of XML infoset that is
* to be marked.
*
* @param src
* The {@link AbstractCreator} or {@link AbstractProcessor} from which the current
* position of creation of the XMLStreamBuffer will be taken as the mark.
*/
public XMLStreamBufferMark(Map inscopeNamespaces, AbstractCreatorProcessor src) {
if(inscopeNamespaces != null) {
_inscopeNamespaces = inscopeNamespaces;
}
_structure = src._currentStructureFragment;
_structurePtr = src._structurePtr;
_structureStrings = src._currentStructureStringFragment;
_structureStringsPtr = src._structureStringsPtr;
_contentCharactersBuffer = src._currentContentCharactersBufferFragment;
_contentCharactersBufferPtr = src._contentCharactersBufferPtr;
_contentObjects = src._currentContentObjectFragment;
_contentObjectsPtr = src._contentObjectsPtr;
treeCount = 1; // TODO: define a way to create a mark over a forest
}
}