java.lang.IndexOutOfBoundsException despite setLength()
Please take a look at the following code:
RandomAccessFile file =new RandomAccessFile("file","rw");// the file didn't exist prior to this instruction
file.setLength(1000);
file.write(buffer, 0, 200);
file.write(buffer, 200, 200);
The first write() works ok but the second one throws java.lang.IndexOutOfBoundsException. Shouldn't it just write another 200 bytes to the file since I've used setLength()?
Thanks.

