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

Side by Side Diff: tool/input_sdk/lib/convert/byte_conversion.dart

Issue 1965563003: Update dart:convert and dart:core Uri. (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.convert; 5 part of dart.convert;
6 6
7 /** 7 /**
8 * The [ByteConversionSink] provides an interface for converters to 8 * The [ByteConversionSink] provides an interface for converters to
9 * efficiently transmit byte data. 9 * efficiently transmit byte data.
10 * 10 *
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 * This class adapts a simple [Sink] to a [ByteConversionSink]. 57 * This class adapts a simple [Sink] to a [ByteConversionSink].
58 * 58 *
59 * All additional methods of the [ByteConversionSink] (compared to the 59 * All additional methods of the [ByteConversionSink] (compared to the
60 * ChunkedConversionSink) are redirected to the `add` method. 60 * ChunkedConversionSink) are redirected to the `add` method.
61 */ 61 */
62 class _ByteAdapterSink extends ByteConversionSinkBase { 62 class _ByteAdapterSink extends ByteConversionSinkBase {
63 final Sink<List<int>> _sink; 63 final Sink<List<int>> _sink;
64 64
65 _ByteAdapterSink(this._sink); 65 _ByteAdapterSink(this._sink);
66 66
67 void add(List<int> chunk) => _sink.add(chunk); 67 void add(List<int> chunk) { _sink.add(chunk); }
68 void close() => _sink.close(); 68 void close() { _sink.close(); }
69 } 69 }
70 70
71 /** 71 /**
72 * This class accumulates all chunks into one list of bytes 72 * This class accumulates all chunks into one list of bytes
73 * and invokes a callback when the sink is closed. 73 * and invokes a callback when the sink is closed.
74 * 74 *
75 * This class can be used to terminate a chunked conversion. 75 * This class can be used to terminate a chunked conversion.
76 */ 76 */
77 class _ByteCallbackSink extends ByteConversionSinkBase { 77 class _ByteCallbackSink extends ByteConversionSinkBase {
78 static const _INITIAL_BUFFER_SIZE = 1024; 78 static const _INITIAL_BUFFER_SIZE = 1024;
(...skipping 28 matching lines...) Expand all
107 v |= v >> 8; 107 v |= v >> 8;
108 v |= v >> 16; 108 v |= v >> 16;
109 v++; 109 v++;
110 return v; 110 return v;
111 } 111 }
112 112
113 void close() { 113 void close() {
114 _callback(_buffer.sublist(0, _bufferIndex)); 114 _callback(_buffer.sublist(0, _bufferIndex));
115 } 115 }
116 } 116 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698