Chromium Code Reviews| Index: lib/src/hex.dart |
| diff --git a/lib/src/hex.dart b/lib/src/hex.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..5c50701e4e33b1be56df8ffe7a4ad9d09e456349 |
| --- /dev/null |
| +++ b/lib/src/hex.dart |
| @@ -0,0 +1,26 @@ |
| +// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +library convert.hex; |
| + |
| +import 'dart:convert'; |
| + |
| +import 'hex/encoder.dart'; |
| +import 'hex/decoder.dart'; |
| + |
| +export 'hex/encoder.dart' hide hexEncoder; |
| +export 'hex/decoder.dart' hide hexDecoder; |
| + |
| +/// The canonical instance of [HexCodec]. |
| +const hex = const HexCodec._(); |
| + |
| +/// A codec that converts byte arrays to and from hexadecimal strings. |
| +/// |
| +/// This should be used via the [hex] field. |
| +class HexCodec extends Codec<List<int>, String> { |
| + final HexEncoder encoder = hexEncoder; |
|
Lasse Reichstein Nielsen
2015/09/23 08:32:03
I'd make these getters that return the encode/deco
nweiz
2015/09/23 22:04:20
Done.
|
| + final HexDecoder decoder = hexDecoder; |
| + |
| + const HexCodec._(); |
| +} |