Close enough, when it comes to file handling, midp-2.0 has not added anything useful that I can recall.
To get you started heres a method to load a file into memory, for simplicity I have stripped it of error checking:
Code:
// --------------------------------------------------------------------- //
public byte[] LoadFile(String fileName)
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
try
{
InputStream in = this.getClass().getResourceAsStream(fileName);
byte aoBuffer[] = new byte[512];
int nBytesRead,t=0;
while ( (nBytesRead = in.read(aoBuffer)) > 0 )
{
t += nBytesRead;
out.write(aoBuffer, 0, nBytesRead);
}
in.close();
}
catch(Exception e){}
return out.toByteArray();
}
// --------------------------------------------------------------------- //
There are numerous ways you can do this, but no one easy one.
IBear in mind, the more flexible your text file is, the more complex your code will have to be to parse it (and the large your code will be).
My advice would be convert it into a "char" array and then find the lines manually by looking for '\n' and convert these back into strings.