add support of RBuffer instead of FILE