| 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.convert; | 5 part of dart.convert; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Error thrown by JSON serialization if an object cannot be serialized. | 8 * Error thrown by JSON serialization if an object cannot be serialized. |
| 9 * | 9 * |
| 10 * The [unsupportedObject] field holds that object that failed to be serialized. | 10 * The [unsupportedObject] field holds that object that failed to be serialized. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 * | 250 * |
| 251 * Returns a chunked-conversion sink that accepts at most one object. It is | 251 * Returns a chunked-conversion sink that accepts at most one object. It is |
| 252 * an error to invoke `add` more than once on the returned sink. | 252 * an error to invoke `add` more than once on the returned sink. |
| 253 */ | 253 */ |
| 254 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) { | 254 ChunkedConversionSink<Object> startChunkedConversion(Sink<String> sink) { |
| 255 if (sink is! StringConversionSink) { | 255 if (sink is! StringConversionSink) { |
| 256 sink = new StringConversionSink.from(sink); | 256 sink = new StringConversionSink.from(sink); |
| 257 } else if (sink is _Utf8EncoderSink) { | 257 } else if (sink is _Utf8EncoderSink) { |
| 258 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, | 258 return new _JsonUtf8EncoderSink(sink._sink, _toEncodable, |
| 259 JsonUtf8Encoder._utf8Encode(indent), | 259 JsonUtf8Encoder._utf8Encode(indent), |
| 260 _JsonUtf8EncoderSink.DEFAULT_BUFFER_SIZE); | 260 JsonUtf8Encoder.DEFAULT_BUFFER_SIZE); |
| 261 } | 261 } |
| 262 return new _JsonEncoderSink(sink, _toEncodable, indent); | 262 return new _JsonEncoderSink(sink, _toEncodable, indent); |
| 263 } | 263 } |
| 264 | 264 |
| 265 // Override the base-classes bind, to provide a better type. | 265 // Override the base-classes bind, to provide a better type. |
| 266 Stream<String> bind(Stream<Object> stream) => super.bind(stream); | 266 Stream<String> bind(Stream<Object> stream) => super.bind(stream); |
| 267 | 267 |
| 268 Converter<Object, dynamic> fuse(Converter<String, dynamic> other) { | 268 Converter<Object, dynamic> fuse(Converter<String, dynamic> other) { |
| 269 if (other is Utf8Encoder) { | 269 if (other is Utf8Encoder) { |
| 270 return new JsonUtf8Encoder(indent, _toEncodable); | 270 return new JsonUtf8Encoder(indent, _toEncodable); |
| (...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1029 buffer.setRange(index, end, indent); | 1029 buffer.setRange(index, end, indent); |
| 1030 index = end; | 1030 index = end; |
| 1031 } else { | 1031 } else { |
| 1032 for (int i = 0; i < indentLength; i++) { | 1032 for (int i = 0; i < indentLength; i++) { |
| 1033 writeByte(indent[i]); | 1033 writeByte(indent[i]); |
| 1034 } | 1034 } |
| 1035 } | 1035 } |
| 1036 } | 1036 } |
| 1037 } | 1037 } |
| 1038 } | 1038 } |
| OLD | NEW |