src/java.xml/share/classes/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
|
3 * @LastModified: Oct 2017 |
3 */ |
4 */ |
4 /* |
5 /* |
5 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * Licensed to the Apache Software Foundation (ASF) under one or more |
6 * contributor license agreements. See the NOTICE file distributed with |
7 * contributor license agreements. See the NOTICE file distributed with |
7 * this work for additional information regarding copyright ownership. |
8 * this work for additional information regarding copyright ownership. |
20 |
21 |
21 package com.sun.org.apache.xerces.internal.dom; |
22 package com.sun.org.apache.xerces.internal.dom; |
22 |
23 |
23 import java.util.ArrayList; |
24 import java.util.ArrayList; |
24 import java.util.HashMap; |
25 import java.util.HashMap; |
|
26 import java.util.List; |
25 import org.w3c.dom.DOMImplementation; |
27 import org.w3c.dom.DOMImplementation; |
26 import org.w3c.dom.Element; |
28 import org.w3c.dom.Element; |
27 import org.w3c.dom.Node; |
29 import org.w3c.dom.Node; |
28 |
30 |
29 /** |
31 /** |
130 |
132 |
131 // |
133 // |
132 // private data |
134 // private data |
133 // |
135 // |
134 private transient final StringBuilder fBufferStr = new StringBuilder(); |
136 private transient final StringBuilder fBufferStr = new StringBuilder(); |
135 private transient final ArrayList fStrChunks = new ArrayList(); |
137 private transient final List<String> fStrChunks = new ArrayList<>(); |
136 |
138 |
137 // |
139 // |
138 // Constructors |
140 // Constructors |
139 // |
141 // |
140 |
142 |
1142 |
1144 |
1143 int chunkCount = fStrChunks.size(); |
1145 int chunkCount = fStrChunks.size(); |
1144 |
1146 |
1145 // add to the buffer in the correct order. |
1147 // add to the buffer in the correct order. |
1146 for (int i = chunkCount - 1; i >= 0; i--) { |
1148 for (int i = chunkCount - 1; i >= 0; i--) { |
1147 fBufferStr.append((String)fStrChunks.get(i)); |
1149 fBufferStr.append(fStrChunks.get(i)); |
1148 } |
1150 } |
1149 |
1151 |
1150 value = fBufferStr.toString(); |
1152 value = fBufferStr.toString(); |
1151 fStrChunks.clear(); |
1153 fStrChunks.clear(); |
1152 fBufferStr.setLength(0); |
1154 fBufferStr.setLength(0); |
1168 fStrChunks.add(value); |
1170 fStrChunks.add(value); |
1169 child = getChunkIndex(fNodePrevSib, chunk, index); |
1171 child = getChunkIndex(fNodePrevSib, chunk, index); |
1170 } |
1172 } |
1171 // add to the buffer in the correct order. |
1173 // add to the buffer in the correct order. |
1172 for (int i=fStrChunks.size()-1; i>=0; i--) { |
1174 for (int i=fStrChunks.size()-1; i>=0; i--) { |
1173 fBufferStr.append((String)fStrChunks.get(i)); |
1175 fBufferStr.append(fStrChunks.get(i)); |
1174 } |
1176 } |
1175 |
1177 |
1176 value = fBufferStr.toString(); |
1178 value = fBufferStr.toString(); |
1177 fStrChunks.clear(); |
1179 fStrChunks.clear(); |
1178 fBufferStr.setLength(0); |
1180 fBufferStr.setLength(0); |