OLD | NEW |
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 #library("input_stream"); | 5 #library("input_stream"); |
6 | 6 |
7 #import("archive.dart", prefix: "archive"); | 7 #import("archive.dart", prefix: "archive"); |
8 #import("entry.dart"); | 8 #import("entry.dart"); |
9 #import("read_request.dart"); | 9 #import("read_request.dart"); |
10 #import("utils.dart"); | 10 #import("utils.dart"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 close(); | 52 close(); |
53 if (_onClosed != null) _onClosed(); | 53 if (_onClosed != null) _onClosed(); |
54 }); | 54 }); |
55 | 55 |
56 attachFinalizer(this, (id) { | 56 attachFinalizer(this, (id) { |
57 if (id.value != null) call(FREE, id.value).then(() {}); | 57 if (id.value != null) call(FREE, id.value).then(() {}); |
58 }, _id); | 58 }, _id); |
59 } | 59 } |
60 | 60 |
61 /** Whether this stream has finished reading entries. */ | 61 /** Whether this stream has finished reading entries. */ |
62 bool get closed() => _id.value == null; | 62 bool get closed => _id.value == null; |
63 | 63 |
64 /** | 64 /** |
65 * Reads the entire contents of the archive at once. | 65 * Reads the entire contents of the archive at once. |
66 * | 66 * |
67 * Note that this is mutually exclusive with reading individual entries using | 67 * Note that this is mutually exclusive with reading individual entries using |
68 * [onEntry]. | 68 * [onEntry]. |
69 */ | 69 */ |
70 Future<List<CompleteArchiveEntry>> readAll() { | 70 Future<List<CompleteArchiveEntry>> readAll() { |
71 var completer = new Completer<List<Future<CompleteArchiveEntry>>>(); | 71 var completer = new Completer<List<Future<CompleteArchiveEntry>>>(); |
72 var result = <Future<CompleteArchiveEntry>>[]; | 72 var result = <Future<CompleteArchiveEntry>>[]; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 if (entry.isInputOpen) return entry.inputComplete; | 154 if (entry.isInputOpen) return entry.inputComplete; |
155 return new Future.immediate(null); | 155 return new Future.immediate(null); |
156 }); | 156 }); |
157 future.onComplete((_) { | 157 future.onComplete((_) { |
158 _currentEntry = null; | 158 _currentEntry = null; |
159 entry.close(); | 159 entry.close(); |
160 }); | 160 }); |
161 return future; | 161 return future; |
162 } | 162 } |
163 } | 163 } |
OLD | NEW |