From ad84a3bad254c8f8eaebb41c236ecf8fc3e71aae Mon Sep 17 00:00:00 2001 From: jhugunin Date: Tue, 31 Dec 2002 19:11:22 +0000 Subject: [PATCH] boolean array read/write --- util/src/org/aspectj/util/FileUtil.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/util/src/org/aspectj/util/FileUtil.java b/util/src/org/aspectj/util/FileUtil.java index b9a91b001..0d4d76989 100644 --- a/util/src/org/aspectj/util/FileUtil.java +++ b/util/src/org/aspectj/util/FileUtil.java @@ -813,6 +813,27 @@ public class FileUtil { } + /** + * Reads a boolean array with our encoding + */ + public static boolean[] readBooleanArray(DataInputStream s) throws IOException { + int len = s.readInt(); + boolean[] ret = new boolean[len]; + for (int i=0; i < len; i++) ret[i] = s.readBoolean(); + return ret; + } + + + /** + * Writes a boolean array with our encoding + */ + public static void writeBooleanArray(boolean[] a, DataOutputStream s) throws IOException { + int len = a.length; + s.writeInt(len); + for (int i=0; i < len; i++) s.writeBoolean(a[i]); + } + + /** * Reads an int array with our encoding */ @@ -827,7 +848,7 @@ public class FileUtil { /** * Writes an int array with our encoding */ - public static void writeIntArray(DataOutputStream s, int[] a) throws IOException { + public static void writeIntArray(int[] a, DataOutputStream s) throws IOException { int len = a.length; s.writeInt(len); for (int i=0; i < len; i++) s.writeInt(a[i]); @@ -849,7 +870,7 @@ public class FileUtil { /** * Writes an int array with our encoding */ - public static void writeStringArray(DataOutputStream s, String[] a) throws IOException { + public static void writeStringArray(String[] a, DataOutputStream s) throws IOException { if (a == null) { s.writeInt(0); return; -- 2.39.5