Calculating chunk size and length with computeBufferLength method