From 02cf57eafe81d23c61c4142114f201e497d38735 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 23 Jul 2020 22:16:16 -0400 Subject: [PATCH] proxy it's slow :( --- .../io/src/main/java/com/opensr5/io/WriteStream.java | 2 ++ .../main/java/com/rusefi/io/serial/AbstractIoStream.java | 6 ++++++ .../io/src/main/java/com/rusefi/io/tcp/TcpIoStream.java | 6 ++++++ 3 files changed, 14 insertions(+) diff --git a/java_console/io/src/main/java/com/opensr5/io/WriteStream.java b/java_console/io/src/main/java/com/opensr5/io/WriteStream.java index fa5e27f26f..9e215204ec 100644 --- a/java_console/io/src/main/java/com/opensr5/io/WriteStream.java +++ b/java_console/io/src/main/java/com/opensr5/io/WriteStream.java @@ -12,6 +12,8 @@ public interface WriteStream { */ void write(byte[] bytes) throws IOException; + void flush() throws IOException; + default void write(byte value) throws IOException { write(new byte[]{value}); } diff --git a/java_console/io/src/main/java/com/rusefi/io/serial/AbstractIoStream.java b/java_console/io/src/main/java/com/rusefi/io/serial/AbstractIoStream.java index 4dd56f039f..78bdac9d59 100644 --- a/java_console/io/src/main/java/com/rusefi/io/serial/AbstractIoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/serial/AbstractIoStream.java @@ -2,6 +2,8 @@ package com.rusefi.io.serial; import com.rusefi.io.IoStream; +import java.io.IOException; + public abstract class AbstractIoStream implements IoStream { private boolean isClosed; @@ -17,6 +19,10 @@ public abstract class AbstractIoStream implements IoStream { isClosed = true; } + @Override + public void flush() throws IOException { + } + @Override public boolean isClosed() { return isClosed; diff --git a/java_console/io/src/main/java/com/rusefi/io/tcp/TcpIoStream.java b/java_console/io/src/main/java/com/rusefi/io/tcp/TcpIoStream.java index fbea5e9430..236efe3d69 100644 --- a/java_console/io/src/main/java/com/rusefi/io/tcp/TcpIoStream.java +++ b/java_console/io/src/main/java/com/rusefi/io/tcp/TcpIoStream.java @@ -65,6 +65,12 @@ public class TcpIoStream extends AbstractIoStream { @Override public void write(byte[] bytes) throws IOException { output.write(bytes); + flush(); + } + + @Override + public void flush() throws IOException { + super.flush(); output.flush(); }