diff options
author | Darin Wright | 2010-03-25 15:17:01 +0000 |
---|---|---|
committer | Darin Wright | 2010-03-25 15:17:01 +0000 |
commit | abe8e66392f27cebe39c753c231523167c1a6724 (patch) | |
tree | 16d37f8b5acde4598622d4796a19dd76f914c583 /org.eclipse.debug.core | |
parent | 788cc5932ecfb396bb865143f4cd4803bdb30397 (diff) | |
download | eclipse.platform.debug-abe8e66392f27cebe39c753c231523167c1a6724.tar.gz eclipse.platform.debug-abe8e66392f27cebe39c753c231523167c1a6724.tar.xz eclipse.platform.debug-abe8e66392f27cebe39c753c231523167c1a6724.zip |
Bug 279328 - Console View : Problem in UTF-8 translation
Diffstat (limited to 'org.eclipse.debug.core')
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java | 34 | ||||
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java | 9 |
2 files changed, 30 insertions, 13 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java index d2a5dc93d..933dabf8d 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/InputStreamMonitor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,7 +18,7 @@ import java.util.Vector; import org.eclipse.debug.core.DebugPlugin; /** - * Writes to the input stream of a system process, + * Writes to the input stream of a system process, * queueing output if the stream is blocked. * * The input stream monitor writes to system in via @@ -47,17 +47,32 @@ public class InputStreamMonitor { * Whether the underlying output stream has been closed */ private boolean fClosed = false; + + /** + * The encoding of the input stream. + */ + private String fEncoding; /** - * Creates an input stream monitor which writes - * to system in via the given output stream. + * Creates an input stream monitor which writes to system in via the given output stream. * * @param stream output stream */ public InputStreamMonitor(OutputStream stream) { + this(stream, null); + } + + /** + * Creates an input stream monitor which writes to system in via the given output stream. + * + * @param stream output stream + * @param encoding stream encoding or <code>null</code> for system default + */ + public InputStreamMonitor(OutputStream stream, String encoding) { fStream= stream; fQueue= new Vector(); fLock= new Object(); + fEncoding= encoding; } /** @@ -83,8 +98,8 @@ public class InputStreamMonitor { public void run() { write(); } - }, DebugCoreMessages.InputStreamMonitor_label); - fThread.setDaemon(true); + }, DebugCoreMessages.InputStreamMonitor_label); + fThread.setDaemon(true); fThread.start(); } } @@ -97,7 +112,7 @@ public class InputStreamMonitor { if (fThread != null) { Thread thread= fThread; fThread= null; - thread.interrupt(); + thread.interrupt(); } } @@ -125,7 +140,10 @@ public class InputStreamMonitor { String text = (String)fQueue.firstElement(); fQueue.removeElementAt(0); try { - fStream.write(text.getBytes()); + if (fEncoding != null) + fStream.write(text.getBytes(fEncoding)); + else + fStream.write(text.getBytes()); fStream.flush(); } catch (IOException e) { DebugPlugin.log(e); diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java index 99eeee9b8..0bae93602 100644 --- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java +++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -18,8 +18,7 @@ import org.eclipse.debug.core.model.IStreamsProxy; import org.eclipse.debug.core.model.IStreamsProxy2; /** - * Standard implementation of a streams proxy for s - * StreamsProxy + * Standard implementation of a streams proxy for IStreamsProxy. */ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { @@ -54,7 +53,7 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { } fOutputMonitor= new OutputStreamMonitor(process.getInputStream(), encoding); fErrorMonitor= new OutputStreamMonitor(process.getErrorStream(), encoding); - fInputMonitor= new InputStreamMonitor(process.getOutputStream()); + fInputMonitor= new InputStreamMonitor(process.getOutputStream(), encoding); fOutputMonitor.startMonitoring(); fErrorMonitor.startMonitoring(); fInputMonitor.startMonitoring(); @@ -96,7 +95,7 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { * communications between it and the * underlying streams immediately. * Data remaining in the streams is lost. - */ + */ public void kill() { synchronized (this) { fClosed= true; |