[jbosstools-commits] JBoss Tools SVN: r39800 - trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Fri Mar 23 10:57:46 EDT 2012


Author: yradtsevich
Date: 2012-03-23 10:57:46 -0400 (Fri, 23 Mar 2012)
New Revision: 39800

Modified:
   trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java
Log:
https://issues.jboss.org/browse/JBIDE-11179 : BrowserSim - add a view source option
- converted output streams to char format

Modified: trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java	2012-03-23 13:57:07 UTC (rev 39799)
+++ trunk/vpe/plugins/org.jboss.tools.vpe.browsersim.eclipse/src/org/jboss/tools/vpe/browsersim/eclipse/util/BrowserSimLauncher.java	2012-03-23 14:57:46 UTC (rev 39800)
@@ -10,9 +10,13 @@
  ******************************************************************************/
 package org.jboss.tools.vpe.browsersim.eclipse.util;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -57,14 +61,17 @@
 			
 			Process browserSimProcess = processBuilder.start();
 
-			final InputStream errorStream = browserSimProcess.getErrorStream();
-			final InputStream inputStream = browserSimProcess.getInputStream();
+			final InputStreamReader errorReader = new InputStreamReader(browserSimProcess.getErrorStream());
+			final InputStreamReader inputReader = new InputStreamReader(browserSimProcess.getInputStream());
+
 			new Thread() {
 				public void run() {
-					int nextByte;
+					int nextCharInt;
+					String nextLine;
 					try {
-						while ((nextByte = inputStream.read()) >= 0) {
-							System.out.write(nextByte);
+						while ((nextCharInt = inputReader.read()) >= 0) {
+							char nextChar = (char) nextCharInt;
+							System.out.print(nextChar);
 						}
 					} catch (IOException e) {
 						e.printStackTrace();
@@ -73,10 +80,10 @@
 			}.start();
 			new Thread() {
 				public void run() {
-					int nextByte;
+					int nextCharInt;
 					try {
-						while ((nextByte = errorStream.read()) >= 0) {
-							System.err.write(nextByte);
+						while ((nextCharInt = errorReader.read()) >= 0) {
+							System.err.print((char) nextCharInt);
 						}
 					} catch (IOException e) {
 						e.printStackTrace();



More information about the jbosstools-commits mailing list