Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for #writeChars and #readChars #136

Open
collinsmith opened this issue Dec 13, 2020 · 0 comments
Open

Add support for #writeChars and #readChars #136

collinsmith opened this issue Dec 13, 2020 · 0 comments
Labels

Comments

@collinsmith
Copy link
Owner

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant