refactored in PersistableResource so that we can manipulate between
bytes and inputstream more easily, and print its contents