Ah OK, I see your issue.  We may end up having read in more than one record.  I don't think that it is possible with a pipe (there are guarantees of atomicity of reads below a certain size I believe) but I agree it would be more robust like that.