From 984a0864ea755b9dc35c6c4bf81d841b9681011d Mon Sep 17 00:00:00 2001 From: Collin Smith Date: Mon, 10 Aug 2020 18:34:12 -0700 Subject: [PATCH] Implemented writeString(CharSequence,int) --- core/src/com/riiablo/io/BitOutput.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/src/com/riiablo/io/BitOutput.java b/core/src/com/riiablo/io/BitOutput.java index 85d91034..10afc721 100644 --- a/core/src/com/riiablo/io/BitOutput.java +++ b/core/src/com/riiablo/io/BitOutput.java @@ -190,4 +190,17 @@ public class BitOutput { write64(value, Long.SIZE); return this; } + + public BitOutput writeString(CharSequence chars, int bits) { + BitConstraints.validateAscii(bits); + + final int length = chars.length(); + if (length == 0) return this; + for (int i = 0; i < length; i++) { + final char c = chars.charAt(i); + _writeRaw(c, bits); + } + + return this; + } }