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

Handling of missing 'len' parameter in OutputStream.writeFrom #292

Closed
DartBot opened this issue Nov 1, 2011 · 3 comments
Closed

Handling of missing 'len' parameter in OutputStream.writeFrom #292

DartBot opened this issue Nov 1, 2011 · 3 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Nov 1, 2011

This issue was originally filed by [email protected]


The new OutputStream interface contains the following code:

/**
 * Writes [len] bytes from buffer [buffer] starting at offset
 * [offset] to the output stream. If [offset] is not specified the
 * default is 0. If [len] is not specified the default is the length
 * of the buffer passed. The system will copy the data to be written
 * so the caller can safely change [buffer] afterwards. Returns true
 * if the data could be written to the underlying communication
 * channel immediately. Otherwise the data is buffered by the output
 * stream and will be sent as soon as possible.
 */
bool writeFrom(List<int> buffer, [int offset, int len]);

It seems like it would be more useful for the value of len (if not supplied) to be equal to (buffer.length - offset) rather than buffer.length. Thus would allow 'writeFrom(buf, offset)' to mean 'write the portion of the buffer from offset forward', whereas in the current scheme it will always result in an IndexOutOfRangeException when offset > 0.

@whesse
Copy link
Contributor

whesse commented Nov 2, 2011

cc @madsager.
Set owner to @sgjesse.
Added Accepted label.

@sgjesse
Copy link
Contributor

sgjesse commented Nov 7, 2011

Proposed change in http://codereview.chromium.org/8493002/.

@sgjesse
Copy link
Contributor

sgjesse commented Nov 8, 2011

Committed: https://code.google.com/p/dart/source/detail?r=1293


Added Fixed label.

This issue was closed.
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. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

4 participants