Fix condition to cast as int or long
Fix to dispose CodecBuffer in the codec
Fix to use an internal byte array if exists
Throw BufferOverflowException if buffer is small

Sub classes of BufferSink follows the contract of
BufferSink#transferTo(ByteBuffer).