#3 implement file-like object interface