com.sun.xml.stream.buffer.AbstractCreatorProcessor Maven / Gradle / Ivy
/*
* 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;
@SuppressWarnings("PointlessBitwiseExpression")
public abstract class AbstractCreatorProcessor {
/**
* Flag on a T_DOCUMENT to indicate if a fragment
*/
protected static final int FLAG_DOCUMENT_FRAGMENT = 1 << 0;
/*
* Flags on T_ELEMENT, T_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE
* to indicate namespace information is represent
*/
protected static final int FLAG_PREFIX = 1 << 0;
protected static final int FLAG_URI = 1 << 1;
protected static final int FLAG_QUALIFIED_NAME = 1 << 2;
/*
* Types of content for T_TEXT and T_COMMENT
*
* Highest 2 bits of lower nibble are used.
*/
protected static final int CONTENT_TYPE_CHAR_ARRAY = 0 << 2;
protected static final int CONTENT_TYPE_CHAR_ARRAY_COPY = 1 << 2;
protected static final int CONTENT_TYPE_STRING = 2 << 2;
protected static final int CONTENT_TYPE_OBJECT = 3 << 2;
/*
* Size of the length of character content for CONTENT_TYPE_CHAR_ARRAY
*
* Last bit of lower nibble is used.
*/
protected static final int CHAR_ARRAY_LENGTH_SMALL = 0;
protected static final int CHAR_ARRAY_LENGTH_MEDIUM = 1;
protected static final int CHAR_ARRAY_LENGTH_SMALL_SIZE = 1 << 8;
protected static final int CHAR_ARRAY_LENGTH_MEDIUM_SIZE = 1 << 16;
/*
* Types of value for T_ATTRIBUTE
*
* Highest bit of lower nibble is used.
*/
protected static final int VALUE_TYPE_STRING = 0;
protected static final int VALUE_TYPE_OBJECT = 1 << 3;
/*
* Mask for types.
*
* Highest nibble is used.
*/
protected static final int TYPE_MASK = 0xF0;
protected static final int T_DOCUMENT = 0x10;
protected static final int T_ELEMENT = 0x20;
protected static final int T_ATTRIBUTE = 0x30;
protected static final int T_NAMESPACE_ATTRIBUTE = 0x40;
protected static final int T_TEXT = 0x50;
protected static final int T_COMMENT = 0x60;
protected static final int T_PROCESSING_INSTRUCTION = 0x70;
protected static final int T_UNEXPANDED_ENTITY_REFERENCE = 0x80;
protected static final int T_END = 0x90;
/*
* Composed types.
*
* One octet is used.
*/
protected static final int T_DOCUMENT_FRAGMENT = T_DOCUMENT | FLAG_DOCUMENT_FRAGMENT;
protected static final int T_ELEMENT_U_LN_QN = T_ELEMENT | FLAG_URI | FLAG_QUALIFIED_NAME;
protected static final int T_ELEMENT_P_U_LN = T_ELEMENT | FLAG_PREFIX | FLAG_URI;
protected static final int T_ELEMENT_U_LN = T_ELEMENT | FLAG_URI;
protected static final int T_ELEMENT_LN = T_ELEMENT;
protected static final int T_NAMESPACE_ATTRIBUTE_P = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX;
protected static final int T_NAMESPACE_ATTRIBUTE_P_U = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX | FLAG_URI;
protected static final int T_NAMESPACE_ATTRIBUTE_U = T_NAMESPACE_ATTRIBUTE | FLAG_URI;
protected static final int T_ATTRIBUTE_U_LN_QN = T_ATTRIBUTE | FLAG_URI | FLAG_QUALIFIED_NAME;
protected static final int T_ATTRIBUTE_P_U_LN = T_ATTRIBUTE | FLAG_PREFIX | FLAG_URI;
protected static final int T_ATTRIBUTE_U_LN = T_ATTRIBUTE | FLAG_URI;
protected static final int T_ATTRIBUTE_LN = T_ATTRIBUTE;
protected static final int T_ATTRIBUTE_U_LN_QN_OBJECT = T_ATTRIBUTE_U_LN_QN | VALUE_TYPE_OBJECT;
protected static final int T_ATTRIBUTE_P_U_LN_OBJECT = T_ATTRIBUTE_P_U_LN | VALUE_TYPE_OBJECT;
protected static final int T_ATTRIBUTE_U_LN_OBJECT = T_ATTRIBUTE_U_LN | VALUE_TYPE_OBJECT;
protected static final int T_ATTRIBUTE_LN_OBJECT = T_ATTRIBUTE_LN | VALUE_TYPE_OBJECT;
protected static final int T_TEXT_AS_CHAR_ARRAY = T_TEXT;
protected static final int T_TEXT_AS_CHAR_ARRAY_SMALL = T_TEXT | CHAR_ARRAY_LENGTH_SMALL;
protected static final int T_TEXT_AS_CHAR_ARRAY_MEDIUM = T_TEXT | CHAR_ARRAY_LENGTH_MEDIUM;
protected static final int T_TEXT_AS_CHAR_ARRAY_COPY = T_TEXT | CONTENT_TYPE_CHAR_ARRAY_COPY;
protected static final int T_TEXT_AS_STRING = T_TEXT | CONTENT_TYPE_STRING;
protected static final int T_TEXT_AS_OBJECT = T_TEXT | CONTENT_TYPE_OBJECT;
protected static final int T_COMMENT_AS_CHAR_ARRAY = T_COMMENT;
protected static final int T_COMMENT_AS_CHAR_ARRAY_SMALL = T_COMMENT | CHAR_ARRAY_LENGTH_SMALL;
protected static final int T_COMMENT_AS_CHAR_ARRAY_MEDIUM = T_COMMENT | CHAR_ARRAY_LENGTH_MEDIUM;
protected static final int T_COMMENT_AS_CHAR_ARRAY_COPY = T_COMMENT | CONTENT_TYPE_CHAR_ARRAY_COPY;
protected static final int T_COMMENT_AS_STRING = T_COMMENT | CONTENT_TYPE_STRING;
protected static final int T_END_OF_BUFFER = -1;
protected FragmentedArray _currentStructureFragment;
protected byte[] _structure;
protected int _structurePtr;
protected FragmentedArray _currentStructureStringFragment;
protected String[] _structureStrings;
protected int _structureStringsPtr;
protected FragmentedArray _currentContentCharactersBufferFragment;
protected char[] _contentCharactersBuffer;
protected int _contentCharactersBufferPtr;
protected FragmentedArray