diff --git a/java_console/inifile/src/main/java/com/opensr5/ConfigurationImage.java b/java_console/inifile/src/main/java/com/opensr5/ConfigurationImage.java index 30fb90cb4d..a556dd26d0 100644 --- a/java_console/inifile/src/main/java/com/opensr5/ConfigurationImage.java +++ b/java_console/inifile/src/main/java/com/opensr5/ConfigurationImage.java @@ -10,10 +10,6 @@ import java.nio.ByteBuffer; * 3/6/2015 */ public class ConfigurationImage { - /** - * This constant is used as a header while saving configuration to a binary file - */ - public final static String BIN_HEADER = "OPEN_SR5_0.1"; private final byte[] content; public ConfigurationImage(int size) { diff --git a/java_console/io/src/main/java/com/opensr5/io/ConfigurationImageFile.java b/java_console/io/src/main/java/com/opensr5/io/ConfigurationImageFile.java index fe6db0c4f1..3070ca93b3 100644 --- a/java_console/io/src/main/java/com/opensr5/io/ConfigurationImageFile.java +++ b/java_console/io/src/main/java/com/opensr5/io/ConfigurationImageFile.java @@ -26,30 +26,14 @@ public class ConfigurationImageFile { @Nullable private static ConfigurationImage readFromStream(int size, FileInputStream fis) throws IOException { - int contentSize = size - ConfigurationImage.BIN_HEADER.length(); - - byte[] header = new byte[ConfigurationImage.BIN_HEADER.length()]; - int result = fis.read(header); - if (result != header.length) { - System.err.println("Error reading header bytes, got " + result); - return null; - } - if (!Arrays.equals(header, ConfigurationImage.BIN_HEADER.getBytes())) { - System.err.println("Header mismatch"); - return null; - } - ConfigurationImage image = new ConfigurationImage(contentSize); - result = fis.read(image.getContent()); + final ConfigurationImage image = new ConfigurationImage(size); + final int result = fis.read(image.getContent()); return result == image.getContent().length ? image : null; } public static byte[] getFileContent(ConfigurationImage configurationImage) { try { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { - byte[] bytes = ConfigurationImage.BIN_HEADER.getBytes(); - if (bytes.length != ConfigurationImage.BIN_HEADER.length()) - throw new IllegalStateException("Encoding issue"); - baos.write(bytes); baos.write(configurationImage.getContent()); return baos.toByteArray(); } diff --git a/java_tools/tune-tools/src/test/resources/frankenso/current_configuration.rusefi_binary b/java_tools/tune-tools/src/test/resources/frankenso/current_configuration.rusefi_binary index 80c8583d21..97eef4cbb0 100644 Binary files a/java_tools/tune-tools/src/test/resources/frankenso/current_configuration.rusefi_binary and b/java_tools/tune-tools/src/test/resources/frankenso/current_configuration.rusefi_binary differ