Innovature interview question

how can we convert a custom class into a file like object