Add support for #writeChars and #readChars
collinsmith opened this issue · 0 comments
collinsmith commented
I've decided the best course of action and to ease complexity with the {read|write}String
methods is to separate the distinction between having and not having a null-termination. I'll amend this as it's being worked out.
The methods I'm looking to creating are:
ByteOutput writeChars(CharSequence chars); // writes chars.length bytes
ByteOutput writeChars(CharSequence chars, int len); // pads with 0's or truncates string
ByteOutput writeString(CharSequence chars); // writes chars.length bytes and an extra 0 for null-termination
ByteOutput writeString(CharSequence chars, int len); // writes string with null-termination or truncates string so final byte is 0
CharSequence readChars(int len); // reads len bytes as a string
CharSequence readString(); // reads bytes until null-termination is found