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

Request: IOSink that constructs a StringBuffer #9051

Open
sethladd opened this issue Mar 11, 2013 · 0 comments
Open

Request: IOSink that constructs a StringBuffer #9051

sethladd opened this issue Mar 11, 2013 · 0 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug

Comments

@sethladd
Copy link
Contributor

See https://groups.google.com/a/dartlang.org/forum/?fromgroups=#!search/BREAKING$20CHANGE:$20IOSink$20interface$20has$20changed/misc/LWIklgvGX8U/L1-PnNhdVpMJ

Request to bridge StringSink and IOSink.

Soren writes:

I must disagree here. A StringSink is something which can receive strings e.g. the StringBuffer. An IOSink is simething which can receive data to be send on an IO channel. The only thing that can be written to an IO channel is bytes. As an IO channel needs bytes then whenever strings are written to an IOSink an encoding is needed for transferring the sequence of code points into bytes. So an IOSink can only be a StringSink if there is an encoding.

For files the openWrite method takes an encoding and the IOSink has a property for changing the encoding in this case. For HTTP the encoding is taken from the "charset" parameter from the "Content-Type" header.

In general you cannot encapsulate HttpResponse to direct the output to a StringBuffer as HTTP is a binary protocol transmitting bytes. In some cases these bytes have a string representation given an encoding.

Tom writes:

Sure, you interpret it this way, and I'm OK with it. However, what I am looking for is an easy way to encapsulate StringBuffer to IOSink. It is something like StringWriter in Java.

@sethladd sethladd added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Mar 11, 2013
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug and removed triaged labels Feb 29, 2016
@lrhn lrhn added the core-m label Aug 11, 2017
@floitschG floitschG added core-n and removed core-m labels Aug 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. core-n P2 A bug or feature request we're likely to work on type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants