Loader for binary format
I am writing a loader for Terragen's .ter files, a landscape generation program. The file format contains an elevation grid, and the height values are given in 16 bits unsigned integers.
My problem is that the loader interface specifies that I must use a Reader in the load() method. And a reader can only read chars... the int read() method, as far as I understand it, first convert the 1 byte ASCII char to 16 bits Unicode, and then to int. it works fine for some values but not for some others (e.g. a binary value of 1000 0000 (128) gives 172... and 0000 0000 gives 32...)
Has anybody any suggestion how I could retreive the true values ?
otherwise, I will forget this method and use only the load(String filename) and load(URL uRL) methods, where I'll be able to use a byteStream instead of the Reader... Does any body know why the API forces the use of a Reader ? I guess Terragen isn't the only binary format around ?
By the way, is anybody interested in such a loader ? I develop it as part of my diploma work but I'd be glad if it can be useful to others...