diff options
author | Paul Pazderski | 2019-12-19 21:57:13 +0000 |
---|---|---|
committer | Paul Pazderski | 2019-12-21 13:46:39 +0000 |
commit | e5d5a40e85cdf4c3788f7ecd2139b9d7ca784702 (patch) | |
tree | d7a562c65d33821b89f61b6ff9d9652cde466a03 /org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java | |
parent | 2e12c38e53c73f7c4d65301d955a36caa57ed73b (diff) | |
download | eclipse.platform.debug-e5d5a40e85cdf4c3788f7ecd2139b9d7ca784702.tar.gz eclipse.platform.debug-e5d5a40e85cdf4c3788f7ecd2139b9d7ca784702.tar.xz eclipse.platform.debug-e5d5a40e85cdf4c3788f7ecd2139b9d7ca784702.zip |
Bug 558489 - [console] Remove unnecessary recoding in ProcessConsoleI20200102-1800I20200101-1800I20191231-1800I20191230-1800I20191229-2200I20191229-1800I20191228-1800I20191227-1800I20191226-1800I20191225-1800I20191224-1800I20191223-1800I20191222-1800I20191221-2205I20191221-1800
output handling
Apart from removing an unnecessary string -> bytes -> string round trip
it fix a potential content corruption since the source (TextConsole)
encoding and target (IOConsoleOutputStream) encoding can differ.
Also the stream listener implementation in ProcessConsole is simplified
a lot and lost some dead code.
Last but not least it replaced some usages of encoding names as strings
with using the Charset class to reduce overall number of charset
lookups.
Change-Id: Ie94aa433e571a2f9898c950d2997f598618aca18
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
Diffstat (limited to 'org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java')
-rw-r--r-- | org.eclipse.debug.core/core/org/eclipse/debug/internal/core/StreamsProxy.java | 16 |
1 files changed, 9 insertions, 7 deletions
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 616e79674..19df55e28 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 @@ -15,6 +15,7 @@ package org.eclipse.debug.internal.core; import java.io.IOException; +import java.nio.charset.Charset; import org.eclipse.debug.core.model.IStreamMonitor; import org.eclipse.debug.core.model.IStreamsProxy; @@ -43,20 +44,21 @@ public class StreamsProxy implements IStreamsProxy, IStreamsProxy2 { * <code>false</code> by default. */ private boolean fClosed; + /** - * Creates a <code>StreamsProxy</code> on the streams - * of the given system process. + * Creates a <code>StreamsProxy</code> on the streams of the given system + * process. * * @param process system process to create a streams proxy on - * @param encoding the process's encoding or <code>null</code> if default + * @param charset the process's charset or <code>null</code> if default */ - public StreamsProxy(Process process, String encoding) { + public StreamsProxy(Process process, Charset charset) { if (process == null) { return; } - fOutputMonitor= new OutputStreamMonitor(process.getInputStream(), encoding); - fErrorMonitor= new OutputStreamMonitor(process.getErrorStream(), encoding); - fInputMonitor= new InputStreamMonitor(process.getOutputStream(), encoding); + fOutputMonitor = new OutputStreamMonitor(process.getInputStream(), charset); + fErrorMonitor = new OutputStreamMonitor(process.getErrorStream(), charset); + fInputMonitor = new InputStreamMonitor(process.getOutputStream(), charset); fOutputMonitor.startMonitoring(); fErrorMonitor.startMonitoring(); fInputMonitor.startMonitoring(); |