From e2a5d2001493bd6d18e586ed9885a162568c644a Mon Sep 17 00:00:00 2001 From: Lyanis Souidi Date: Fri, 28 Apr 2023 15:44:56 +0200 Subject: [PATCH] FIX BUG: FileManager MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problème de lecture --- src/FileManager.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/FileManager.java b/src/FileManager.java index ac06b5f..604832a 100644 --- a/src/FileManager.java +++ b/src/FileManager.java @@ -1,7 +1,7 @@ import java.io.*; /** * Class to manage file import/export - * @version 1.0 + * @version 1.1 * @author Amir Daouadi * @author Lyanis Souidi */ @@ -18,16 +18,16 @@ public class FileManager { FileInputStream fs = new FileInputStream(file); DataInputStream ds = new DataInputStream(fs); try { - grid = new Grid(ds.readByte()); - grid.getThesee().setSquare(grid.getSquare(ds.readByte(), ds.readByte())); - grid.getSquare(ds.readByte(), ds.readByte()).setExit(); + grid = new Grid(ds.read()); + grid.getThesee().setSquare(grid.getSquare(ds.read(), ds.read())); + grid.getSquare(ds.read(), ds.read()).setExit(); int bit = 8; - byte value = 0; + int value = 0; for (int i = 0; i < grid.getSize(); i++) { for (int j = 0; j < grid.getSize(); j++) { if (bit == 8) { - value = ds.readByte(); + value = ds.read(); bit = 0; } if (((value >> (7 - bit)) & 1) == 1) grid.getSquare(j, i).setWall();