Implemented writeString(CharSequence,int)

This commit is contained in:
Collin Smith 2020-08-10 18:34:12 -07:00
parent 2433fac1fe
commit 984a0864ea

View File

@ -190,4 +190,17 @@ public class BitOutput {
write64(value, Long.SIZE); write64(value, Long.SIZE);
return this; 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;
}
} }