Binary file stream support functions