I have an problem with the DataInputStream, it doesn't read the file completly there are every so often (every ~33000 chars) 2-3 chars skipped. I am trying to parse the file (8 mb) as json and with those skipped chars in the string I can't parse the string as json.
public static String readTemplate(String templateName) throws IOException
{
log.info("Opening Template");
InputStream resStream = this.getClass().getResourceAsStream("/assets/"+SpellCraftMod.MODID+"/templates/"+templateName+".json"); // I need to open the file that way
DataInputStream in = new DataInputStream(resStream);
String temp = "";
SpellCraftMod.log.info("Reading Data");
int available = 0;
while ((available = in.available()) > 0)
{
try
{
temp += in.readUTF();
} catch (EOFException ignore) {}
log.info("To GO: " + available);
}
log.info("Closing File");
in.close();
resStream.close();
return temp;
}