From 821add2a623763e7afc2703f8d597ed96b8de7ed Mon Sep 17 00:00:00 2001 From: dong9297 Date: Thu, 26 May 2022 20:29:33 +0800 Subject: [PATCH] add write boolean to util --- src/main/base/org/bdware/sc/conn/ByteUtil.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/base/org/bdware/sc/conn/ByteUtil.java b/src/main/base/org/bdware/sc/conn/ByteUtil.java index a0625ec..fdb33d0 100644 --- a/src/main/base/org/bdware/sc/conn/ByteUtil.java +++ b/src/main/base/org/bdware/sc/conn/ByteUtil.java @@ -80,6 +80,14 @@ public class ByteUtil { } } + public static boolean readBoolean(ByteArrayInputStream bi) { + return bi.read() == 0x01; + } + + public static void writeBoolean(ByteArrayOutputStream bo, boolean b) { + bo.write(b ? 0x01 : 0x00); + } + public static byte[] readBytes(ByteArrayInputStream bi, int len) { byte[] ret = new byte[len]; bi.read(ret, 0, len);