i'm writing a text based game that creates a world based on the data inside of the specified file.
however, the code i have won't let me use the function
DataInputStream.ReadFully(byte[]b)
Code:
package textgame;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Stack;
public class world {
Stack<String> LevelData = new Stack<String>();
int location;
int EndLocation;
public world(Stack<String> s, int l, int e)
{
s = this.LevelData;
l = this.location;
e = this.EndLocation;
}
}
class world_render
{
public world RenderWorld(String file)
{
Stack<String> data = new Stack<String>();
int location = 0;
FileInputStream LevelIn = null;
try {
LevelIn = new FileInputStream(file);
} catch (IOException e) {
System.out.println("IOException in file " + file + "!");
e.printStackTrace();
}
DataInputStream DataIn = new DataInputStream(LevelIn);
byte[] DATA = DataIn.readFully(DATA);
for(byte x : DATA)
{
data.add(new String(Integer.toHexString((int)x).toUpperCase()));
}
int endOfLevel = data.size();
return new world(data, location, endOfLevel);
}
}
Not sure if it is a problem with eclipse, or with my code. ideas?