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

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

Issue 10915007: Use new getters syntax in dart:io. A few were missed in the first round of cleanup. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | runtime/bin/chunked_stream.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 /** 5 /**
6 * Utility class that holds a number of byte buffers and can deliver 6 * Utility class that holds a number of byte buffers and can deliver
7 * the bytes either one by one or in chunks. 7 * the bytes either one by one or in chunks.
8 */ 8 */
9 class _BufferList { 9 class _BufferList {
10 _BufferList() { 10 _BufferList() {
(...skipping 10 matching lines...) Expand all
21 _buffers.addLast(buffer); 21 _buffers.addLast(buffer);
22 _length += buffer.length; 22 _length += buffer.length;
23 if (offset != 0) _index = offset; 23 if (offset != 0) _index = offset;
24 } 24 }
25 25
26 /** 26 /**
27 * Returns the first buffer from the list. This returns the whole 27 * Returns the first buffer from the list. This returns the whole
28 * buffer and does not remove the buffer from the list. Use 28 * buffer and does not remove the buffer from the list. Use
29 * [index] to determine the index of the first byte in the buffer. 29 * [index] to determine the index of the first byte in the buffer.
30 */ 30 */
31 List<int> get first() => _buffers.first(); 31 List<int> get first => _buffers.first();
32 32
33 /** 33 /**
34 * Returns the current index of the next byte. This will always be 34 * Returns the current index of the next byte. This will always be
35 * an index into the first buffer as when the index is advanced past 35 * an index into the first buffer as when the index is advanced past
36 * the end of a buffer it is removed from the list. 36 * the end of a buffer it is removed from the list.
37 */ 37 */
38 int get index() => _index; 38 int get index => _index;
39 39
40 /** 40 /**
41 * Peek at the next available byte. 41 * Peek at the next available byte.
42 */ 42 */
43 int peek() => _buffers.first()[_index]; 43 int peek() => _buffers.first()[_index];
44 44
45 /** 45 /**
46 * Returns the next available byte removing it from the buffers. 46 * Returns the next available byte removing it from the buffers.
47 */ 47 */
48 int next() { 48 int next() {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } else { 122 } else {
123 _index += count; 123 _index += count;
124 } 124 }
125 _length -= count; 125 _length -= count;
126 } 126 }
127 127
128 128
129 /** 129 /**
130 * Returns the total number of bytes remaining in the buffers. 130 * Returns the total number of bytes remaining in the buffers.
131 */ 131 */
132 int get length() => _length; 132 int get length => _length;
133 133
134 /** 134 /**
135 * Returns whether the buffer list is empty that is has no bytes 135 * Returns whether the buffer list is empty that is has no bytes
136 * available. 136 * available.
137 */ 137 */
138 bool isEmpty() => _buffers.isEmpty(); 138 bool isEmpty() => _buffers.isEmpty();
139 139
140 /** 140 /**
141 * Clears the content of the buffer list. 141 * Clears the content of the buffer list.
142 */ 142 */
143 void clear() { 143 void clear() {
144 _index = 0; 144 _index = 0;
145 _length = 0; 145 _length = 0;
146 _buffers = new Queue(); 146 _buffers = new Queue();
147 } 147 }
148 148
149 int _length; // Total number of bytes remaining in the buffers. 149 int _length; // Total number of bytes remaining in the buffers.
150 Queue<List<int>> _buffers; // List of data buffers. 150 Queue<List<int>> _buffers; // List of data buffers.
151 int _index; // Index of the next byte in the first buffer. 151 int _index; // Index of the next byte in the first buffer.
152 } 152 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/chunked_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698