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

Side by Side Diff: runtime/bin/string_stream.dart

Issue 10414021: Reland: Add more API fuzzing and fix the issues encountered. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file_impl.dart ('k') | tests/standalone/io/file_fuzz_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Interface for decoders decoding binary data into string data. The 5 // Interface for decoders decoding binary data into string data. The
6 // decoder keeps track of line breaks during decoding. 6 // decoder keeps track of line breaks during decoding.
7 interface _StringDecoder { 7 interface _StringDecoder {
8 // Add more binary data to be decoded. The ownership of the buffer 8 // Add more binary data to be decoded. The ownership of the buffer
9 // is transfered to the decoder and the caller most not modify it any more. 9 // is transfered to the decoder and the caller most not modify it any more.
10 int write(List<int> buffer); 10 int write(List<int> buffer);
(...skipping 19 matching lines...) Expand all
30 30
31 class _StringDecoders { 31 class _StringDecoders {
32 static _StringDecoder decoder(Encoding encoding) { 32 static _StringDecoder decoder(Encoding encoding) {
33 if (encoding == Encoding.UTF_8) { 33 if (encoding == Encoding.UTF_8) {
34 return new _UTF8Decoder(); 34 return new _UTF8Decoder();
35 } else if (encoding == Encoding.ISO_8859_1) { 35 } else if (encoding == Encoding.ISO_8859_1) {
36 return new _Latin1Decoder(); 36 return new _Latin1Decoder();
37 } else if (encoding == Encoding.ASCII) { 37 } else if (encoding == Encoding.ASCII) {
38 return new _AsciiDecoder(); 38 return new _AsciiDecoder();
39 } else { 39 } else {
40 throw new StreamException("Unsupported encoding ${encoding.name}"); 40 if (encoding is Encoding) {
41 throw new StreamException("Unsupported encoding ${encoding.name}");
42 } else {
43 throw new StreamException("Unsupported encoding ${encoding}");
44 }
41 } 45 }
42 } 46 }
43 } 47 }
44 48
45 49
46 class DecoderException implements Exception { 50 class DecoderException implements Exception {
47 const DecoderException([String this.message]); 51 const DecoderException([String this.message]);
48 String toString() => "DecoderException: $message"; 52 String toString() => "DecoderException: $message";
49 final String message; 53 final String message;
50 } 54 }
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 bool _inputClosed = false; // Is the underlying input stream closed? 514 bool _inputClosed = false; // Is the underlying input stream closed?
511 bool _closed = false; // Is this stream closed. 515 bool _closed = false; // Is this stream closed.
512 bool _eof = false; // Has all data been read from the decoder? 516 bool _eof = false; // Has all data been read from the decoder?
513 Timer _scheduledDataCallback; 517 Timer _scheduledDataCallback;
514 Timer _scheduledLineCallback; 518 Timer _scheduledLineCallback;
515 Timer _scheduledCloseCallback; 519 Timer _scheduledCloseCallback;
516 Function _clientDataHandler; 520 Function _clientDataHandler;
517 Function _clientLineHandler; 521 Function _clientLineHandler;
518 Function _clientCloseHandler; 522 Function _clientCloseHandler;
519 } 523 }
OLDNEW
« no previous file with comments | « runtime/bin/file_impl.dart ('k') | tests/standalone/io/file_fuzz_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698