
================
*bstream library
================

This is a collection of iostream-compatible classes of fully-binary streams.
That means that this code:

	int num = 1234;
	obstream os;
	os << num;

Will not write '1234' to the stream, but the 4-byte binary value 00 00 04 D2.
All integers are converted to network byte order using [nh]to[hn][sl] funcs,
unless BSTREAMS_NATIVE_BO is defined. Same for all other C primitives.

All the changes are in ibstream.h and obstream.h. Operators >> and <<
respectively are hidden (not overloaded since in istream and ostream
they are not vitrual) by their new binary versions. Since these classes
are derived from istream and ostream respectively, all functionality is
still there, except for non-implemented operators >> and << which are
hidden and are not available. Those are the manipulator operators (which
do not make sense in binary files) and void* operators (I can't save
a void* pointer because there is no way to measure its size) For void*
you can use the read and write functions, still available from the
base classes.

The other unwanted side effect of this operator hiding is that you can't
pass bstreams instead of istream or ostream because the function will use
the hidden operators. See ex2.cc.

Most of these operators will simply route your request to read and write
calls. Somewhat more complicated piece of code is the char* operators. These
will measure the length of the passed in string (using strlen) and prepend
it to the data using the following rules:
	if the string is less than 255 chars long, the size is in the first
		character.
	if the string is UCHAR_MAX chars or more, the first byte is 0xFF 
	    	and the second and third bytes hold a short int with size.
	if the string is USHRT_MAX or more, the first three bytes are 0xFF
	    	and the fourth through seventh bytes hold a long int with size.
This arrangement provides minimum size storage overhead.

Strings sizes are written using the value of BSTREAMS_NATIVE_BO that the
library was compiled with. That means that if you use native in your
program and compiled the library without native, string sizes are still
written in network byte order. Of course, this only affects strings
longer than 255 characters, so in most cases you will not care.

