smee / binary

Clojure API for binary format I/O using java's stream apis
74 stars 10 forks source link

Native arrays for repeated primitives #4

Closed zsau closed 10 years ago

zsau commented 10 years ago

Would it be possible for repeated to output a native array when given a primitive codec? This would be especially useful for codecs that include binary blobs, since wrapping each byte in a java.lang.Byte is quite wasteful.

A separate codec like repeated-prim or even just bytes would also work.

zsau commented 10 years ago

I think the most common use case would be reading binary chunks, so I created a codec blob that's essentially an optimized implementation of (repeated :byte ...).

It's in the feat/blobs branch; let me know what you think.

smee commented 10 years ago

Thanks for your commits! This looks good to me. Feel free to merge it into master.

zsau commented 10 years ago

Added in 30226ca692c930c668b94a2b1e3c240338dd0a17.