Does FileInputStream acquire lock
I am seeing weird behaviour:
1. fin = new FileInputStream(f);
if (null == (in = new InputStreamReader(fin))) {
return;
}
if (null != in) {
bData = null;
sData = null;
System.out.println(schname + " Currently Working on "
+ f.getAbsoluteFile());
if (null != in) {
br = new BufferedReader(in);
StringBuilder sBuildValidateData = new StringBuilder();
StringBuilder s = new StringBuilder();
while ((sData = br.readLine()) != null) // read data
{
}
}
2. Now after reading from BufferedReader if I try to rename file f using f.renameTo(); then it doesn't rename. And, also when I try to cut paste the file it tells me that it's being used by other program - which means it has a lock.
3. Now I try the same code on UNIX, and it just works fine.
Is it that windows implementation locks the file when it's being read ?

