create a variable length buffer codec. This will first write out the length of the
value buffer and then the value buffer itself. The lengthCodec may be
variable length itself (i.e. a varint), but must encode an integer.

create a variable length codec that encodes an array of items.
itemCodec may be any varstruct compatible codec, including a vararray.
As long as it can encode very element in the array.
lengthCodec must encode an integer.