Chromium Code Reviews| 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 class _FileInputStream extends _BaseDataInputStream implements InputStream { | 7 class _FileInputStream extends _BaseDataInputStream implements InputStream { |
| 8 _FileInputStream(String name) | 8 _FileInputStream(String name) |
| 9 : _data = const [], | 9 : _data = const [], |
| 10 _position = 0, | 10 _position = 0, |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 697 | 697 |
| 698 void writeAsStringSync(String contents, | 698 void writeAsStringSync(String contents, |
| 699 [FileMode mode = FileMode.WRITE, | 699 [FileMode mode = FileMode.WRITE, |
| 700 Encoding encoding = Encoding.UTF_8]) { | 700 Encoding encoding = Encoding.UTF_8]) { |
| 701 var data = _StringEncoders.encoder(encoding).encodeString(contents); | 701 var data = _StringEncoders.encoder(encoding).encodeString(contents); |
| 702 writeAsBytesSync(data, mode); | 702 writeAsBytesSync(data, mode); |
| 703 } | 703 } |
| 704 | 704 |
| 705 String get name => _name; | 705 String get name => _name; |
| 706 | 706 |
| 707 String toString() => "File: '$name'"; | |
|
Søren Gjesse
2012/12/21 10:16:00
Ditto.
| |
| 708 | |
| 707 void _ensureFileService() { | 709 void _ensureFileService() { |
| 708 if (_fileService == null) { | 710 if (_fileService == null) { |
| 709 _fileService = _FileUtils._newServicePort(); | 711 _fileService = _FileUtils._newServicePort(); |
| 710 } | 712 } |
| 711 } | 713 } |
| 712 | 714 |
| 713 static throwIfError(Object result, String msg) { | 715 static throwIfError(Object result, String msg) { |
| 714 if (result is OSError) { | 716 if (result is OSError) { |
| 715 throw new FileIOException(msg, result); | 717 throw new FileIOException(msg, result); |
| 716 } | 718 } |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1159 new FileIOException("File closed '$_name'")); | 1161 new FileIOException("File closed '$_name'")); |
| 1160 }); | 1162 }); |
| 1161 return completer.future; | 1163 return completer.future; |
| 1162 } | 1164 } |
| 1163 | 1165 |
| 1164 final String _name; | 1166 final String _name; |
| 1165 int _id; | 1167 int _id; |
| 1166 | 1168 |
| 1167 SendPort _fileService; | 1169 SendPort _fileService; |
| 1168 } | 1170 } |
| OLD | NEW |