Line data Source code
1 : // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
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.
4 :
5 : import 'dart:convert';
6 :
7 : import 'chunked_coding/encoder.dart';
8 : import 'chunked_coding/decoder.dart';
9 :
10 : export 'chunked_coding/encoder.dart' hide chunkedCodingEncoder;
11 : export 'chunked_coding/decoder.dart' hide chunkedCodingDecoder;
12 :
13 : /// The canonical instance of [ChunkedCodec].
14 : const chunkedCoding = const ChunkedCodingCodec._();
15 :
16 : /// A codec that encodes and decodes the [chunked transfer coding][].
17 : ///
18 : /// [chunked transfer coding]: https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1
19 : ///
20 : /// The [encoder] creates a *single* chunked message for each call to
21 : /// [ChunkedEncoder.convert] or [ChunkedEncoder.startChunkedConversion]. This
22 : /// means that it will always add an end-of-message footer once conversion has
23 : /// finished. It doesn't support generating chunk extensions or trailing
24 : /// headers.
25 : ///
26 : /// Similarly, the [decoder] decodes a *single* chunked message into a stream of
27 : /// byte arrays that must be concatenated to get the full list (like most Dart
28 : /// byte streams). It doesn't support decoding a stream that contains multiple
29 : /// chunked messages, nor does it support a stream that contains chunked data
30 : /// mixed with other types of data.
31 : ///
32 : /// Currently, [decoder] will fail to parse chunk extensions and trailing
33 : /// headers. It may be updated to silently ignore them in the future.
34 : class ChunkedCodingCodec extends Codec<List<int>, List<int>> {
35 : ChunkedCodingEncoder get encoder => chunkedCodingEncoder;
36 : ChunkedCodingDecoder get decoder => chunkedCodingDecoder;
37 :
38 0 : const ChunkedCodingCodec._();
39 : }
|