unicorn commit: + fix of function getContent

changeset:   1568:d8be99f9906c
tag:         tip
user:        Thomas Gambet <tgambet@w3.org>
date:        Tue Nov 23 13:47:04 2010 -0500
files:       src/org/w3c/unicorn/input/URIInputModule.java
description:
+ fix of function getContent


diff -r 15ab38bfb84e -r d8be99f9906c src/org/w3c/unicorn/input/URIInputModule.java
--- a/src/org/w3c/unicorn/input/URIInputModule.java	Fri Nov 19 12:07:12 2010 -0500
+++ b/src/org/w3c/unicorn/input/URIInputModule.java	Tue Nov 23 13:47:04 2010 -0500
@@ -5,6 +5,7 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.PrintWriter;
 import java.net.URL;
 import java.util.Date;
@@ -111,9 +112,13 @@
 	public String getStringContent() throws IOException {
 		logger.trace("getString.");
 		final URL aURL = new URL(this.sURI);
-		final String sResult = (String) aURL.openConnection().getContent();
-		logger.debug("sResult : " + sResult + ".");
-		return sResult;
+		InputStream in = aURL.openConnection().getInputStream();
+	    StringBuffer out = new StringBuffer();
+	    byte[] b = new byte[4096];
+	    for (int n; (n = in.read(b)) != -1;) {
+	        out.append(new String(b, 0, n));
+	    }
+	    return out.toString();
 	}
 
 	public String getURI() {

Received on Tuesday, 23 November 2010 18:47:12 UTC