C
Chameleon
I have write this member function for reading a text file in UC-16BE
format (means unicode, 2 bytes/char, big endian)
----------------------------------------------------------
static public String loadFile(String s) throws Exception {
DataInputStream isr = new
DataInputStream(FileLoader.class.getResourceAsStream(s));
s = "";
for(int z = isr.available() / 2; z > 0; z--)
s += isr.readChar();
return s.substring(1);
}
----------------------------------------------------------
the problem is, that this function is slower than I want, because it
reads one by one characters from file.
Is there any better idea?
I don't care if I must convert my text files from UC-16BE to UC-16LE or
UTF-8, so feel free to make any changes (but not 1 byte/char).
Thanks a lot
format (means unicode, 2 bytes/char, big endian)
----------------------------------------------------------
static public String loadFile(String s) throws Exception {
DataInputStream isr = new
DataInputStream(FileLoader.class.getResourceAsStream(s));
s = "";
for(int z = isr.available() / 2; z > 0; z--)
s += isr.readChar();
return s.substring(1);
}
----------------------------------------------------------
the problem is, that this function is slower than I want, because it
reads one by one characters from file.
Is there any better idea?
I don't care if I must convert my text files from UC-16BE to UC-16LE or
UTF-8, so feel free to make any changes (but not 1 byte/char).
Thanks a lot