Replace java.nio with parts of https://github.com/Strikeskids/CacheReader for JDK 6 compatibility and hopefully avoid security exceptions