clearspring/stream-lib — pull request #34 by cykl (2013-05-28 21:23:10+00:00)
Title: Remove IOException from ICardinality.getBytes()

I extensively use the built-in serialization/de-serialization mechanism offered by ICardinality estimators and was a bit irritated by having to catch cumbersome and useless IOExceptions. As long as we are working with byte buffers their is no reason to throw IOException to the caller.

This pull request update the ICardinality.getBytes() method to remove IOException:
- HyperLogLog and HyperLogLogPlus have been update to use ByteBuffer rather than ByteArrayOutputStream. No more IOExceptions and it is [faster](https://microbenchmarks.appspot.com/runs/9106b89c-dfaf-4742-8069-8aaec853c0c)
- ExternalizableUtil.toBytes() catchs IOExceptions and rethrow an unchecked IllegalStateException. IOException will never be thrown since we are using a ByteArrayOutputStream.
- Builders have also been update to remove IOException

I took care to not change the serialization format to be backward compatible. API changes should also be backward compatible for client. The only possible issue would be a third party implementation of ICardinality throwing an IOException.