1. Change the argument on all onError handlers from Exception to
Dynamic
2. Throw an exception if an error ocours and there is no error handler
present for handling it.
For sockets there is the complication that an error on a socket is
reported to the socket error handler, and each of the stream error
handlers. The solution to this is to throw an exception if there was
no error handler on either the socket or one of the streams.
Fixed a number of bugs in tests revealed by errors no longer being
silently ignored.
R=ager@google.com
BUG=none
TEST=tests/standalone/src/io/*
Review URL: https://chromiumcodereview.appspot.com//10173024
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6994 260f80e4-7a28-3924-810f-c04153c831b5
Change the streams onError callbacks to get an Exception argument on
all streams.
Added actual error handling to the socket streams.
As it is difficult to determine where an error should be reported I
decided to call all the registered onError callbacks, that is on the
socket itself and on both input and output stream.
Did some additional cleanup of the naming of OnError argument in some tests.
R=ager@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9812007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5717 260f80e4-7a28-3924-810f-c04153c831b5
All output streams now supports writeString which takes the encoding
to be used when transforming the string into a sequence of bytes.
This change also introduces an Encoding interface and Encodings class
as a repository for the supported encodings. Currently this is only
UTF-8, ISO-8859-1 and ASCII. All methods in dart:io which previously
used a String to represent the encoding now uses objects implementing
Encoding.
In this change dart:io is still using the internal UTF-8 encoder used
by the HTTP implementation. I will look into using the one in dart:utf
in a separate change.
R=ager@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9653026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5231 260f80e4-7a28-3924-810f-c04153c831b5
1. The string input stream now calls the data or line handler if there
is still data available after returning from the data or line
handler. These callbacks are scheduled on the event loop.
2. The reading of data is now throtteld so that calls to read or
readLine will not eagerly try to read from the wrapped input
stream. After each call to read the data handler is installed if
no more buffered data is available. Also when the data handler
is called the data handler on the wrapped input stream is
un-installed if no more data is required for the current data or
line handler.
One side effect of this change is that just reading from an input
stream obtained from a file is no longer possible. One will have to
set up a data handler callback of some kind before any calls to read
will return data. We can of cause change this to allow synchronous
usage of an input stream obtained from a file (maybe with an optional
argument to openInputStream).
Fixed a related throtteling issue with the chunked input stream.
R=ager@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8885032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2310 260f80e4-7a28-3924-810f-c04153c831b5
This adds the line handler to the string stream to provide callbacks
when a line is known to be available.
This change also refactors parts of the string stream to avoid
converting decoded char codes to a string before checking for line
break sequences. With this change the string decoder tracks all line
breaks.
There is still room for improvement as e.g. the coping of the list of
char codes when reading lines can be avoided by using anoher offset.
R=ager@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8772008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2016 260f80e4-7a28-3924-810f-c04153c831b5