Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Issue 8698018: Update of the input stream interface (Closed)

Created:
9 years ago by Søren Gjesse
Modified:
9 years ago
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Update of the input stream interface This combines the StringInputStream and the InputStream interfaces. BUG= TEST=

Patch Set 1 #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+43 lines, -49 lines) Patch
M runtime/bin/input_stream.dart View 1 chunk +43 lines, -49 lines 5 comments Download

Messages

Total messages: 3 (0 generated)
Søren Gjesse
This is a RFC on consolidation of the input stream interface I have tried to ...
9 years ago (2011-11-28 14:18:37 UTC) #1
Mads Ager (google)
This gets pretty complicated. Søren and I discussed this today and we would prefer to ...
9 years ago (2011-11-30 10:44:07 UTC) #2
Ivan Posva
9 years ago (2011-12-01 18:23:52 UTC) #3
I fully agree with Mads that the lowest level input stream should only provide
bytes to make it easy on other sources of input to implement the bottleneck
interface and leave all the handling of encodings et al. to higher levels.
Otherwise I suspect there will develop a parallel interface that is simpler to
implement, which will only cause fragmentation.

-Ivan


On 2011/11/30 10:44:07, Mads Ager wrote:
> This gets pretty complicated.
> 
> Søren and I discussed this today and we would prefer to keep InputStream
really,
> really simple. The only thing that it can do is tell you when there are bytes
> ready to be read. On top of that you can build StringInputStreams and
> ChunkedInputStreams and any other type of interpretation of the raw bytes with
> only one level of buffering. Additionally it has the advantage that someone
can
> write an InputStream which is just a byte provider very quickly and get
> StringInputStream and ChunkedInputStreams for free.
> 
> The down side is that you have to do wrapping. However, I think that is worth
> the simplicity in the implementation and for the programmer wanting to provide
> an InputStream:
> 
> var input = new StringInputStream(process.stdout, 'UTF-8');
> input.lineHandler = () {
>   // Do stuff with the lines that you get from readLine.
>   // This handler is only called when a full line is available.
> }
> 
> var input = new ChunkedInputStream(process.stdout, 1024);
> input.chunkHandler = () {
>   // Do stuff with the chunks you get from readChunk.
>   // This handler is only called when a full chunk is available.
>   // You can change the chunk size with assignments: chunkSize = 512;
> }
> 
> http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart
> File runtime/bin/input_stream.dart (right):
> 
>
http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart#n...
> runtime/bin/input_stream.dart:10: * Reads data from the stream. If no encoding
> is set fir the stream
> fir -> for
> 
>
http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart#n...
> runtime/bin/input_stream.dart:38: Object readUntil(Object pattern);
> Should pattern have type Pattern?
> 
>
http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart#n...
> runtime/bin/input_stream.dart:50: * Returns the number of bytes available for
> immediate reading.
> Hmm, bytes or characters depending on the encoding?
> 
>
http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart#n...
> runtime/bin/input_stream.dart:58: * the encodings "UTF-8", "ISO-8859-1" and
> "ASCII" are supported.
> Maybe there should always be an encoding? A default 'RAW' encoding that means
> that you just want to read the bytes?
> 
>
http://codereview.chromium.org/8698018/diff/1/runtime/bin/input_stream.dart#n...
> runtime/bin/input_stream.dart:64: * Sets the minimum number of bytes required
to
> trigger a the
> Again, is this bytes or characters depending on the encoding or is it just
> bytes?

Powered by Google App Engine
This is Rietveld 408576698