1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/AbstractCreatorProcessor.java Tue Mar 06 16:09:35 2012 -0800 1.3 @@ -0,0 +1,141 @@ 1.4 +/* 1.5 + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 +package com.sun.xml.internal.stream.buffer; 1.30 + 1.31 +public abstract class AbstractCreatorProcessor { 1.32 + /** 1.33 + * Flag on a T_DOCUMENT to indicate if a fragment 1.34 + */ 1.35 + protected static final int FLAG_DOCUMENT_FRAGMENT = 1 << 0; 1.36 + 1.37 + /* 1.38 + * Flags on T_ELEMENT, T_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE 1.39 + * to indicate namespace information is represent 1.40 + */ 1.41 + protected static final int FLAG_PREFIX = 1 << 0; 1.42 + protected static final int FLAG_URI = 1 << 1; 1.43 + protected static final int FLAG_QUALIFIED_NAME = 1 << 2; 1.44 + 1.45 + /* 1.46 + * Types of content for T_TEXT and T_COMMENT 1.47 + * <p> 1.48 + * Highest 2 bits of lower nibble are used. 1.49 + */ 1.50 + protected static final int CONTENT_TYPE_CHAR_ARRAY = 0 << 2; 1.51 + protected static final int CONTENT_TYPE_CHAR_ARRAY_COPY = 1 << 2; 1.52 + protected static final int CONTENT_TYPE_STRING = 2 << 2; 1.53 + protected static final int CONTENT_TYPE_OBJECT = 3 << 2; 1.54 + 1.55 + /* 1.56 + * Size of the length of character content for CONTENT_TYPE_CHAR_ARRAY 1.57 + * <p> 1.58 + * Last bit of lower nibble is used. 1.59 + */ 1.60 + protected static final int CHAR_ARRAY_LENGTH_SMALL = 0; 1.61 + protected static final int CHAR_ARRAY_LENGTH_MEDIUM = 1; 1.62 + protected static final int CHAR_ARRAY_LENGTH_SMALL_SIZE = 1 << 8; 1.63 + protected static final int CHAR_ARRAY_LENGTH_MEDIUM_SIZE = 1 << 16; 1.64 + 1.65 + /* 1.66 + * Types of value for T_ATTRIBUTE 1.67 + * <p> 1.68 + * Highest bit of lower nibble is used. 1.69 + */ 1.70 + protected static final int VALUE_TYPE_STRING = 0; 1.71 + protected static final int VALUE_TYPE_OBJECT = 1 << 3; 1.72 + 1.73 + /* 1.74 + * Mask for types. 1.75 + * <p> 1.76 + * Highest nibble is used. 1.77 + */ 1.78 + protected static final int TYPE_MASK = 0xF0; 1.79 + protected static final int T_DOCUMENT = 0x10; 1.80 + protected static final int T_ELEMENT = 0x20; 1.81 + protected static final int T_ATTRIBUTE = 0x30; 1.82 + protected static final int T_NAMESPACE_ATTRIBUTE = 0x40; 1.83 + protected static final int T_TEXT = 0x50; 1.84 + protected static final int T_COMMENT = 0x60; 1.85 + protected static final int T_PROCESSING_INSTRUCTION = 0x70; 1.86 + protected static final int T_UNEXPANDED_ENTITY_REFERENCE = 0x80; 1.87 + protected static final int T_END = 0x90; 1.88 + 1.89 + /* 1.90 + * Composed types. 1.91 + * <p> 1.92 + * One octet is used. 1.93 + */ 1.94 + protected static final int T_DOCUMENT_FRAGMENT = T_DOCUMENT | FLAG_DOCUMENT_FRAGMENT; 1.95 + 1.96 + protected static final int T_ELEMENT_U_LN_QN = T_ELEMENT | FLAG_URI | FLAG_QUALIFIED_NAME; 1.97 + protected static final int T_ELEMENT_P_U_LN = T_ELEMENT | FLAG_PREFIX | FLAG_URI; 1.98 + protected static final int T_ELEMENT_U_LN = T_ELEMENT | FLAG_URI; 1.99 + protected static final int T_ELEMENT_LN = T_ELEMENT; 1.100 + 1.101 + protected static final int T_NAMESPACE_ATTRIBUTE_P = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX; 1.102 + protected static final int T_NAMESPACE_ATTRIBUTE_P_U = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX | FLAG_URI; 1.103 + protected static final int T_NAMESPACE_ATTRIBUTE_U = T_NAMESPACE_ATTRIBUTE | FLAG_URI; 1.104 + 1.105 + protected static final int T_ATTRIBUTE_U_LN_QN = T_ATTRIBUTE | FLAG_URI | FLAG_QUALIFIED_NAME; 1.106 + protected static final int T_ATTRIBUTE_P_U_LN = T_ATTRIBUTE | FLAG_PREFIX | FLAG_URI; 1.107 + protected static final int T_ATTRIBUTE_U_LN = T_ATTRIBUTE | FLAG_URI; 1.108 + protected static final int T_ATTRIBUTE_LN = T_ATTRIBUTE; 1.109 + protected static final int T_ATTRIBUTE_U_LN_QN_OBJECT = T_ATTRIBUTE_U_LN_QN | VALUE_TYPE_OBJECT; 1.110 + protected static final int T_ATTRIBUTE_P_U_LN_OBJECT = T_ATTRIBUTE_P_U_LN | VALUE_TYPE_OBJECT; 1.111 + protected static final int T_ATTRIBUTE_U_LN_OBJECT = T_ATTRIBUTE_U_LN | VALUE_TYPE_OBJECT; 1.112 + protected static final int T_ATTRIBUTE_LN_OBJECT = T_ATTRIBUTE_LN | VALUE_TYPE_OBJECT; 1.113 + 1.114 + protected static final int T_TEXT_AS_CHAR_ARRAY = T_TEXT; 1.115 + protected static final int T_TEXT_AS_CHAR_ARRAY_SMALL = T_TEXT | CHAR_ARRAY_LENGTH_SMALL; 1.116 + protected static final int T_TEXT_AS_CHAR_ARRAY_MEDIUM = T_TEXT | CHAR_ARRAY_LENGTH_MEDIUM; 1.117 + protected static final int T_TEXT_AS_CHAR_ARRAY_COPY = T_TEXT | CONTENT_TYPE_CHAR_ARRAY_COPY; 1.118 + protected static final int T_TEXT_AS_STRING = T_TEXT | CONTENT_TYPE_STRING; 1.119 + protected static final int T_TEXT_AS_OBJECT = T_TEXT | CONTENT_TYPE_OBJECT; 1.120 + 1.121 + protected static final int T_COMMENT_AS_CHAR_ARRAY = T_COMMENT; 1.122 + protected static final int T_COMMENT_AS_CHAR_ARRAY_SMALL = T_COMMENT | CHAR_ARRAY_LENGTH_SMALL; 1.123 + protected static final int T_COMMENT_AS_CHAR_ARRAY_MEDIUM = T_COMMENT | CHAR_ARRAY_LENGTH_MEDIUM; 1.124 + protected static final int T_COMMENT_AS_CHAR_ARRAY_COPY = T_COMMENT | CONTENT_TYPE_CHAR_ARRAY_COPY; 1.125 + protected static final int T_COMMENT_AS_STRING = T_COMMENT | CONTENT_TYPE_STRING; 1.126 + 1.127 + protected static final int T_END_OF_BUFFER = -1; 1.128 + 1.129 + protected FragmentedArray<byte[]> _currentStructureFragment; 1.130 + protected byte[] _structure; 1.131 + protected int _structurePtr; 1.132 + 1.133 + protected FragmentedArray<String[]> _currentStructureStringFragment; 1.134 + protected String[] _structureStrings; 1.135 + protected int _structureStringsPtr; 1.136 + 1.137 + protected FragmentedArray<char[]> _currentContentCharactersBufferFragment; 1.138 + protected char[] _contentCharactersBuffer; 1.139 + protected int _contentCharactersBufferPtr; 1.140 + 1.141 + protected FragmentedArray<Object[]> _currentContentObjectFragment; 1.142 + protected Object[] _contentObjects; 1.143 + protected int _contentObjectsPtr; 1.144 +}