add write boolean to util

This commit is contained in:
dong9297 2022-05-26 20:29:33 +08:00
parent 488fbb4a63
commit 821add2a62

View File

@ -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);