| OLD | NEW |
| 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.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 // Read the file in blocks of size 64k. | 7 // Read the file in blocks of size 64k. |
| 8 const int _BLOCK_SIZE = 64 * 1024; | 8 const int _BLOCK_SIZE = 64 * 1024; |
| 9 | 9 |
| 10 | 10 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 const int _STAT_REQUEST = 25; | 227 const int _STAT_REQUEST = 25; |
| 228 | 228 |
| 229 // TODO(ager): The only reason for this class is that the patching | 229 // TODO(ager): The only reason for this class is that the patching |
| 230 // mechanism doesn't seem to like patching a private top level | 230 // mechanism doesn't seem to like patching a private top level |
| 231 // function. | 231 // function. |
| 232 class _FileUtils { | 232 class _FileUtils { |
| 233 external static SendPort _newServicePort(); | 233 external static SendPort _newServicePort(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // Class for encapsulating the native implementation of files. | 236 // Class for encapsulating the native implementation of files. |
| 237 class _File implements File { | 237 class _File extends FileSystemEntity implements File { |
| 238 final String path; | 238 final String path; |
| 239 SendPort _fileService; | 239 SendPort _fileService; |
| 240 | 240 |
| 241 // Constructor for file. | 241 // Constructor for file. |
| 242 _File(String this.path) { | 242 _File(String this.path) { |
| 243 if (path is! String) { | 243 if (path is! String) { |
| 244 throw new ArgumentError('${Error.safeToString(path)} ' | 244 throw new ArgumentError('${Error.safeToString(path)} ' |
| 245 'is not a String'); | 245 'is not a String'); |
| 246 } | 246 } |
| 247 } | 247 } |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 void _checkNotClosed() { | 977 void _checkNotClosed() { |
| 978 if (closed) { | 978 if (closed) { |
| 979 throw new FileException("File closed", path); | 979 throw new FileException("File closed", path); |
| 980 } | 980 } |
| 981 } | 981 } |
| 982 | 982 |
| 983 Future _closedException() { | 983 Future _closedException() { |
| 984 return new Future.error(new FileException("File closed", path)); | 984 return new Future.error(new FileException("File closed", path)); |
| 985 } | 985 } |
| 986 } | 986 } |
| OLD | NEW |