Конструктор фабрики UriData.fromBytes
UriData.fromBytes(Создаёт URI data:, содержащий кодирование bytes.
Эквивалентно new Uri.dataFromBytes(...).data, но может быть эффективнее, если сам uri не используется.
Исходный код
factory UriData.fromBytes(List<int> bytes,
{mimeType: "application/octet-stream",
Map<String, String> parameters,
percentEncoded: false}) {
StringBuffer buffer = new StringBuffer();
List<int> indices = [_noScheme];
_writeUri(mimeType, null, parameters, buffer, indices);
indices.add(buffer.length);
if (percentEncoded) {
buffer.write(',');
_uriEncodeBytes(_uricTable, bytes, buffer);
} else {
buffer.write(';base64,');
indices.add(buffer.length - 1);
BASE64.encoder
.startChunkedConversion(
new StringConversionSink.fromStringSink(buffer))
.addSlice(bytes, 0, bytes.length, true);
}
return new UriData._(buffer.toString(), indices, null);
}
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dartlang.org/stable/1.24.3/dart-core/UriData/UriData.fromBytes.html