io_utils library Null safety

Miscellaneous I/O utilities. This includes reading and writing binary data in a way that's interoperable with and, and support for using Pointycastle to encrypt or decrypt a stream of data, somewhat like javax.crytpo.CipherInputStream and javax.crypto.CypherOutputStream.

/// Example of using [DataOutputSink] and [DataInputStream] to
/// encode values that are compatible with ``
/// and ``
Future<void> data_io_stream_example() async {
  final file = File.fromUri(Directory.systemTemp.uri.resolve('test.dat'));
  final flushable = FlushingIOSink(file.openWrite());
  final out = DataOutputSink(flushable);
  out.writeUTF8('Hello, world.');
  await flushable.done;

  final dis = DataInputStream(file.openRead());
  print(await dis.readUTF8());
  await dis.close();
  await file.delete();


A wrapper around a List, for synchronous reading of typed binary data from a byte array. This is similar to a over a [...]
A coroutines-style wrapper around a Stream<List<int>>, like you get from a socket or a file in Dart. This lets you asynchronously read a stream using an API much like [...]
An adapter over a Sink<List<int>> for writing to a stream. This class presents an API based on Java's [...]
A wrapper around a DataInputStream that decrypts using a Pointycastle BlockCipher, resulting in a Stream<List<int>>. This is functionally similar to javax.crypto.CipherInputStream.
A wrapper around a Sink<List<int>> that encrypts data using a Pointycastle BlockCipher. This sink needs to buffer to build up blocks that can be encrypted, so it's essential that close() be called. This is functionally similar to javax.crypto.CipherOutputStream