Rewritten to use stream read wrapper instead of per compression fopen/fclose

Using fread and fseek on such opened files was not nice either.