I have the following scenario:
Created a level file composed by bytes:
byte[] levels = { 72, 116, -15, 7, 60, -31, -123, 74, 46, 109
... (I have 255 bytes)
The file was created using the following code:
FileOutputStream fos = new FileOutputStream("l");
fos.write(levels);
In my game I’m reading using (HERE IS MY PROBLEM):
getClass().getClassLoader().getResourceAsStream("l").read(levels);
The code above read bytes 0-255 range which return a different result from my original array (byte type -128-127 range). The values -15 that was previously saved is read as 113… and then some items in my game are not displayed because of this issue…
How can I fix it???