Will two File[Out|In]putStreams using the same File object cause havoc?
i.e., I want two streams reading from the different locations in the
file. Or is it better to have a seperate File object for each?
It depends on whether you are trying to solve the problem for one
platform or all. Java does not give you direct access to the OS file
locking mechanisms.
I would expect one of two behaviours:
1. It is possible that on some platform, reading the file does a
general lock on it.
2. Java puts a prevent-write lock on a file whether reading or
writing and prevent-reading lock on a file when writing.
You can find out by experiment for single platform, but if you want to
know the behaviour of all platforms you would have to dig in the
language spec or talk nicely to Patricia Shanahan who has a gift for
understanding the document.
If the file is small, consider just reading it into RAM and sharing
it.