Implement buffered streams.

Adds buffering and line number counting to the abstract `Stream` class.

Currently it does not work well with sockets, especially in the builtin
HTTPD. Workaround for this is to disable buffering with sockets. Some
kind of socket timeout is possibly required for buffered sockets.