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

New methods in KiwiIO to create a ByteArrayInputStream from a String #998

Closed
sleberknight opened this issue Aug 1, 2023 · 0 comments · Fixed by #1000
Closed

New methods in KiwiIO to create a ByteArrayInputStream from a String #998

sleberknight opened this issue Aug 1, 2023 · 0 comments · Fixed by #1000
Assignees
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Milestone

Comments

@sleberknight
Copy link
Member

sleberknight commented Aug 1, 2023

Create methods in KiwiIO to create a ByteArrayInputStream from a String. The places we use this (currently internal to several services) always use UTF-8 but we can have two methods, one that defaults to UTF-8 and an overload that accepts a Charset, e.g.

// proposed method signatures

// convert using UTF-8
ByteArrayInputStream newByteArrayInputStream(String value);

// convert using given Charset
ByteArrayInputStream newByteArrayInputStream(String value, Charset charset);

The "UTF8" method can simply delegate to the other method, passing UTF-8 for the Charset argument.

Also, the existing newByteArrayInputStreamOfLines method could be refactored to call the UTF-8 variant.

@sleberknight sleberknight added the new feature A new feature such as a new class, method, package, group of classes, etc. label Aug 1, 2023
@sleberknight sleberknight added this to the 2.7.0 milestone Aug 1, 2023
@sleberknight sleberknight self-assigned this Aug 1, 2023
sleberknight added a commit that referenced this issue Aug 1, 2023
* Add newByteArrayInputStream method in KiwiIO that converts a
  String to a ByteArrayInputStream.
* Add overload that accepts a Charset

Closes #998
dsingley pushed a commit that referenced this issue Aug 1, 2023
…1000)

* Add newByteArrayInputStream method in KiwiIO that converts a
  String to a ByteArrayInputStream.
* Add overload that accepts a Charset

Closes #998
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature A new feature such as a new class, method, package, group of classes, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant