simple file encoder and decoder