Author: veithen
Date: Wed Apr 28 21:00:08 2010
New Revision: 939085
URL: http://svn.apache.org/viewvc?rev=939085&view=rev
Log:
WSCOMMONS-452: Moved another piece of code that was intended for inclusion into
Axiom.
Added:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java
- copied, changed from r939039,
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeStreamReader.java
Copied:
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java
(from r939039,
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeStreamReader.java)
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java?p2=webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java&p1=axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeStreamReader.java&r1=939039&r2=939085&rev=939085&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/format/WrappedTextNodeStreamReader.java
(original)
+++
webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/stax/WrappedTextNodeStreamReader.java
Wed Apr 28 21:00:08 2010
@@ -1,23 +1,23 @@
/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
-package org.apache.axis2.format;
+package org.apache.axiom.util.stax;
import java.io.IOException;
import java.io.Reader;
@@ -31,8 +31,6 @@ import javax.xml.stream.XMLStreamExcepti
import javax.xml.stream.XMLStreamReader;
import org.apache.axiom.util.namespace.MapBasedNamespaceContext;
-import org.apache.axiom.util.stax.DummyLocation;
-import org.apache.commons.io.IOUtils;
/**
* {...@link XMLInputStreamReader} implementation that
@@ -372,9 +370,14 @@ public class WrappedTextNodeStreamReader
// the character data entirely in memory, but if the caller
// wants a String, we don't have the choice...
try {
- String result = IOUtils.toString(reader);
+ StringBuffer buffer = new StringBuffer();
+ char[] cbuf = new char[4096];
+ int c;
+ while ((c = reader.read(cbuf)) != -1) {
+ buffer.append(cbuf, 0, c);
+ }
eventType = END_ELEMENT;
- return result;
+ return buffer.toString();
}
catch (IOException ex) {
throw new XMLStreamException(ex);