HCOLL-197 - added better support for buffer resize to prevent issues around Integer.MAX_SIZE