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 /** | 5 /** |
6 * This provides a general-purpose serialization facility for Dart objects. A | 6 * This provides a general-purpose serialization facility for Dart objects. A |
7 * [Serialization] is defined in terms of [SerializationRule]s and supports | 7 * [Serialization] is defined in terms of [SerializationRule]s and supports |
8 * reading and writing to different formats. | 8 * reading and writing to different formats. |
9 * | 9 * |
10 * Setup | 10 * Setup |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 | 344 |
345 /** | 345 /** |
346 * Read the serialized data from [input] and return the root object | 346 * Read the serialized data from [input] and return the root object |
347 * from the result. If there are objects that need to be resolved | 347 * from the result. If there are objects that need to be resolved |
348 * in the current context, they should be provided in [externals] as a | 348 * in the current context, they should be provided in [externals] as a |
349 * Map from names to values. In particular, in the current implementation | 349 * Map from names to values. In particular, in the current implementation |
350 * any class mirrors needed should be provided in [externals] using the | 350 * any class mirrors needed should be provided in [externals] using the |
351 * class name as a key. In addition to the [externals] map provided here, | 351 * class name as a key. In addition to the [externals] map provided here, |
352 * values will be looked up in the [externalObjects] map. | 352 * values will be looked up in the [externalObjects] map. |
353 */ | 353 */ |
354 read(String input, [Map externals = const {}]) { | 354 read(input, [Map externals = const {}]) { |
justinfagnani
2013/02/09 21:21:56
now that the type annotation is removed, can you d
Alan Knight
2013/02/11 23:38:42
Done. Also fixed up the main doc comment some.
| |
355 return newReader().read(input, externals); | 355 return newReader().read(input, externals); |
356 } | 356 } |
357 | 357 |
358 /** | 358 /** |
359 * Return a new [Reader] object for this serialization. This is useful if | 359 * Return a new [Reader] object for this serialization. This is useful if |
360 * you want to do something more complex with the reader than just returning | 360 * you want to do something more complex with the reader than just returning |
361 * the final result. | 361 * the final result. |
362 */ | 362 */ |
363 Reader newReader([Format format]) => new Reader(this, format); | 363 Reader newReader([Format format]) => new Reader(this, format); |
364 | 364 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
460 } | 460 } |
461 | 461 |
462 /** | 462 /** |
463 * An exception class for errors during serialization. | 463 * An exception class for errors during serialization. |
464 */ | 464 */ |
465 class SerializationException implements Exception { | 465 class SerializationException implements Exception { |
466 final String message; | 466 final String message; |
467 const SerializationException([this.message]); | 467 const SerializationException([this.message]); |
468 toString() => "SerializationException($message)"; | 468 toString() => "SerializationException($message)"; |
469 } | 469 } |
OLD | NEW |