Chromium Code Reviews| Index: runtime/bin/file_impl.dart |
| diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart |
| index 0aa31fb0291a2ec2602b7a9c2b002804d072e117..e3c9e21a5c33d427bd2bedaf61561f4c8508cbeb 100644 |
| --- a/runtime/bin/file_impl.dart |
| +++ b/runtime/bin/file_impl.dart |
| @@ -902,32 +902,15 @@ class _RandomAccessFile extends _FileBase implements RandomAccessFile { |
| Future<RandomAccessFile> writeString(String string, |
| [Encoding encoding = Encoding.UTF_8]) { |
| - _ensureFileService(); |
| - Completer<RandomAccessFile> completer = new Completer<RandomAccessFile>(); |
| - if (closed) return _completeWithClosedException(completer); |
| - List request = new List(3); |
| - request[0] = _WRITE_STRING_REQUEST; |
|
Søren Gjesse
2012/10/30 10:24:31
Shouldn't we fully remove the write string request
Mads Ager (google)
2012/10/30 11:34:05
Whoops! Good catch. Yes we should.
|
| - request[1] = _id; |
| - request[2] = string; |
| - return _fileService.call(request).transform((response) { |
| - if (_isErrorResponse(response)) { |
| - throw _exceptionFromResponse(response, |
| - "writeString failed for file '$_name'"); |
| - } |
| - return this; |
| - }); |
| + var data = _StringEncoders.encoder(encoding).encodeString(string); |
| + return writeList(data, 0, data.length); |
| } |
| static _writeString(int id, String string) native "File_WriteString"; |
| int writeStringSync(String string, [Encoding encoding = Encoding.UTF_8]) { |
| - _checkNotClosed(); |
| - if (string is !String) throw new ArgumentError(); |
| - var result = _writeString(_id, string); |
| - if (result is OSError) { |
| - throw new FileIOException("writeString failed for file '$_name'"); |
| - } |
| - return result; |
| + var data = _StringEncoders.encoder(encoding).encodeString(string); |
| + return writeListSync(data, 0, data.length); |
| } |
| Future<int> position() { |