New custom stream classes replacing BufferedStream and MemoryStream

Hi all,

Per discussion with @roji, I implemented some Stream classes to replace BufferedStream and MemoryStream, and got them working in Npgsql.

This is really preliminary work, and just the start of a much bigger project that I don't have time to finish, but i think it provides part of the basis needed for Npgsql to really take control of its buffer management.

i did not implement a buffer pool, which may prove to be another important aspect of this project, but a buffer pool is really quite trivial to write, and adapting NpgsqlMemoryStream to it would also be trivial.

The hard, tedious work ahead will lie in refactoring Npgsql to extend and use these new streams to eliminate a lot more allocations and copy operations, partly by taking advantage of the fact that we can have full access to their buffers.

-Glen

Having _while_ instead of _if_ could lead to both an infinite outer for-loop and array out of bounds exception in the inner while-loop, in case the text consists of an invalid UTF-16 string.

Using an _if_ statement will work too. The fallback for a lead surrogate followed by another lead surrogate is to insert the replace character for the first lead surrogate instead. The fallback for a lead surrogate as the end character in a string is also the replace character.