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

Side by Side Diff: sdk/lib/io/buffer_list.dart

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
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 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Utility class that holds a number of byte buffers and can deliver 8 * Utility class that holds a number of byte buffers and can deliver
9 * the bytes either one by one or in chunks. 9 * the bytes either one by one or in chunks.
10 */ 10 */
11 class _BufferList { 11 class _BufferList {
12 _BufferList() { 12 _BufferList() {
13 clear(); 13 clear();
14 } 14 }
15 15
16 /** 16 /**
17 * Adds a new buffer to the list possibly with an offset of the 17 * Adds a new buffer to the list possibly with an offset of the
18 * first byte of interest. The offset can only be specified if the 18 * first byte of interest. The offset can only be specified if the
19 * buffer list is empty. 19 * buffer list is empty.
20 */ 20 */
21 void add(List<int> buffer, [int offset = 0]) { 21 void add(List<int> buffer, [int offset = 0]) {
22 assert(offset == 0 || _buffers.isEmpty); 22 assert(offset == 0 || _buffers.isEmpty);
23 _buffers.addLast(buffer); 23 _buffers.addLast(buffer);
24 _length += buffer.length; 24 _length += buffer.length;
25 if (offset != 0) _index = offset; 25 if (offset != 0) _index = offset;
26 } 26 }
27 27
28 /** Alias for [add]. */
29 void write(List<int> buffer, [int offset = 0]) {
floitsch 2013/03/06 13:38:14 I needed to add this method so that the _BufferLis
Anders Johnsen 2013/03/06 14:31:00 SGTM, can we remove add then?
floitsch 2013/03/08 13:18:39 Maybe. I don't know how _BufferList is otherwise u
30 add(buffer, offset);
31 }
32
28 /** 33 /**
29 * Returns the first buffer from the list. This returns the whole 34 * Returns the first buffer from the list. This returns the whole
30 * buffer and does not remove the buffer from the list. Use 35 * buffer and does not remove the buffer from the list. Use
31 * [index] to determine the index of the first byte in the buffer. 36 * [index] to determine the index of the first byte in the buffer.
32 */ 37 */
33 List<int> get first => _buffers.first; 38 List<int> get first => _buffers.first;
34 39
35 /** 40 /**
36 * Returns the current index of the next byte. This will always be 41 * Returns the current index of the next byte. This will always be
37 * an index into the first buffer as when the index is advanced past 42 * an index into the first buffer as when the index is advanced past
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 void clear() { 150 void clear() {
146 _index = 0; 151 _index = 0;
147 _length = 0; 152 _length = 0;
148 _buffers = new Queue(); 153 _buffers = new Queue();
149 } 154 }
150 155
151 int _length; // Total number of bytes remaining in the buffers. 156 int _length; // Total number of bytes remaining in the buffers.
152 Queue<List<int>> _buffers; // List of data buffers. 157 Queue<List<int>> _buffers; // List of data buffers.
153 int _index; // Index of the next byte in the first buffer. 158 int _index; // Index of the next byte in the first buffer.
154 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698