I tried fileInputStream.reset(), it throws exception says the "mark/reset not supported".
I need to read the file into a byte array, first I have to use a while loop
while ( (currentByte = fin.read() ) != -1) {
fileLength ++; }
to count how many bytes of the file, then using the counter to new a byte array, then use
fin.read(array,0,array.length);
but it doesn't work properly, the file(a pdf) cannot be open. But if I hard code the lengh of the file without a loop, the file generated properly.
So I guess it is the file pointer problem, after the while loop, the pointer is positioned at the end of the file, thus even the subsequent call I specify the beginning position, still doesn't work properly.
I am using websphere 5.1, just support
java 1.3, 1.4 has some new features I can use to avoid a while loop.
And I don't want to create another file input stream, looks not good.
Anybody can help? Thanks a lot.......