src/share/jaxws_classes/com/sun/xml/internal/stream/buffer/AbstractCreatorProcessor.java

changeset 286
f50545b5e2f1
child 397
b99d7e355d4b
equal deleted inserted replaced
284:88b85470e72c 286:f50545b5e2f1
1 /*
2 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package com.sun.xml.internal.stream.buffer;
27
28 public abstract class AbstractCreatorProcessor {
29 /**
30 * Flag on a T_DOCUMENT to indicate if a fragment
31 */
32 protected static final int FLAG_DOCUMENT_FRAGMENT = 1 << 0;
33
34 /*
35 * Flags on T_ELEMENT, T_ATTRIBUTE, T_NAMESPACE_ATTRIBUTE
36 * to indicate namespace information is represent
37 */
38 protected static final int FLAG_PREFIX = 1 << 0;
39 protected static final int FLAG_URI = 1 << 1;
40 protected static final int FLAG_QUALIFIED_NAME = 1 << 2;
41
42 /*
43 * Types of content for T_TEXT and T_COMMENT
44 * <p>
45 * Highest 2 bits of lower nibble are used.
46 */
47 protected static final int CONTENT_TYPE_CHAR_ARRAY = 0 << 2;
48 protected static final int CONTENT_TYPE_CHAR_ARRAY_COPY = 1 << 2;
49 protected static final int CONTENT_TYPE_STRING = 2 << 2;
50 protected static final int CONTENT_TYPE_OBJECT = 3 << 2;
51
52 /*
53 * Size of the length of character content for CONTENT_TYPE_CHAR_ARRAY
54 * <p>
55 * Last bit of lower nibble is used.
56 */
57 protected static final int CHAR_ARRAY_LENGTH_SMALL = 0;
58 protected static final int CHAR_ARRAY_LENGTH_MEDIUM = 1;
59 protected static final int CHAR_ARRAY_LENGTH_SMALL_SIZE = 1 << 8;
60 protected static final int CHAR_ARRAY_LENGTH_MEDIUM_SIZE = 1 << 16;
61
62 /*
63 * Types of value for T_ATTRIBUTE
64 * <p>
65 * Highest bit of lower nibble is used.
66 */
67 protected static final int VALUE_TYPE_STRING = 0;
68 protected static final int VALUE_TYPE_OBJECT = 1 << 3;
69
70 /*
71 * Mask for types.
72 * <p>
73 * Highest nibble is used.
74 */
75 protected static final int TYPE_MASK = 0xF0;
76 protected static final int T_DOCUMENT = 0x10;
77 protected static final int T_ELEMENT = 0x20;
78 protected static final int T_ATTRIBUTE = 0x30;
79 protected static final int T_NAMESPACE_ATTRIBUTE = 0x40;
80 protected static final int T_TEXT = 0x50;
81 protected static final int T_COMMENT = 0x60;
82 protected static final int T_PROCESSING_INSTRUCTION = 0x70;
83 protected static final int T_UNEXPANDED_ENTITY_REFERENCE = 0x80;
84 protected static final int T_END = 0x90;
85
86 /*
87 * Composed types.
88 * <p>
89 * One octet is used.
90 */
91 protected static final int T_DOCUMENT_FRAGMENT = T_DOCUMENT | FLAG_DOCUMENT_FRAGMENT;
92
93 protected static final int T_ELEMENT_U_LN_QN = T_ELEMENT | FLAG_URI | FLAG_QUALIFIED_NAME;
94 protected static final int T_ELEMENT_P_U_LN = T_ELEMENT | FLAG_PREFIX | FLAG_URI;
95 protected static final int T_ELEMENT_U_LN = T_ELEMENT | FLAG_URI;
96 protected static final int T_ELEMENT_LN = T_ELEMENT;
97
98 protected static final int T_NAMESPACE_ATTRIBUTE_P = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX;
99 protected static final int T_NAMESPACE_ATTRIBUTE_P_U = T_NAMESPACE_ATTRIBUTE | FLAG_PREFIX | FLAG_URI;
100 protected static final int T_NAMESPACE_ATTRIBUTE_U = T_NAMESPACE_ATTRIBUTE | FLAG_URI;
101
102 protected static final int T_ATTRIBUTE_U_LN_QN = T_ATTRIBUTE | FLAG_URI | FLAG_QUALIFIED_NAME;
103 protected static final int T_ATTRIBUTE_P_U_LN = T_ATTRIBUTE | FLAG_PREFIX | FLAG_URI;
104 protected static final int T_ATTRIBUTE_U_LN = T_ATTRIBUTE | FLAG_URI;
105 protected static final int T_ATTRIBUTE_LN = T_ATTRIBUTE;
106 protected static final int T_ATTRIBUTE_U_LN_QN_OBJECT = T_ATTRIBUTE_U_LN_QN | VALUE_TYPE_OBJECT;
107 protected static final int T_ATTRIBUTE_P_U_LN_OBJECT = T_ATTRIBUTE_P_U_LN | VALUE_TYPE_OBJECT;
108 protected static final int T_ATTRIBUTE_U_LN_OBJECT = T_ATTRIBUTE_U_LN | VALUE_TYPE_OBJECT;
109 protected static final int T_ATTRIBUTE_LN_OBJECT = T_ATTRIBUTE_LN | VALUE_TYPE_OBJECT;
110
111 protected static final int T_TEXT_AS_CHAR_ARRAY = T_TEXT;
112 protected static final int T_TEXT_AS_CHAR_ARRAY_SMALL = T_TEXT | CHAR_ARRAY_LENGTH_SMALL;
113 protected static final int T_TEXT_AS_CHAR_ARRAY_MEDIUM = T_TEXT | CHAR_ARRAY_LENGTH_MEDIUM;
114 protected static final int T_TEXT_AS_CHAR_ARRAY_COPY = T_TEXT | CONTENT_TYPE_CHAR_ARRAY_COPY;
115 protected static final int T_TEXT_AS_STRING = T_TEXT | CONTENT_TYPE_STRING;
116 protected static final int T_TEXT_AS_OBJECT = T_TEXT | CONTENT_TYPE_OBJECT;
117
118 protected static final int T_COMMENT_AS_CHAR_ARRAY = T_COMMENT;
119 protected static final int T_COMMENT_AS_CHAR_ARRAY_SMALL = T_COMMENT | CHAR_ARRAY_LENGTH_SMALL;
120 protected static final int T_COMMENT_AS_CHAR_ARRAY_MEDIUM = T_COMMENT | CHAR_ARRAY_LENGTH_MEDIUM;
121 protected static final int T_COMMENT_AS_CHAR_ARRAY_COPY = T_COMMENT | CONTENT_TYPE_CHAR_ARRAY_COPY;
122 protected static final int T_COMMENT_AS_STRING = T_COMMENT | CONTENT_TYPE_STRING;
123
124 protected static final int T_END_OF_BUFFER = -1;
125
126 protected FragmentedArray<byte[]> _currentStructureFragment;
127 protected byte[] _structure;
128 protected int _structurePtr;
129
130 protected FragmentedArray<String[]> _currentStructureStringFragment;
131 protected String[] _structureStrings;
132 protected int _structureStringsPtr;
133
134 protected FragmentedArray<char[]> _currentContentCharactersBufferFragment;
135 protected char[] _contentCharactersBuffer;
136 protected int _contentCharactersBufferPtr;
137
138 protected FragmentedArray<Object[]> _currentContentObjectFragment;
139 protected Object[] _contentObjects;
140 protected int _contentObjectsPtr;
141 }

mercurial