Trying to read a log file line-by-line (in Java). This log file is being written to simultaneously by another process (non-java program).
I have 2 approaches -
- BufferedReader (BufferedReader br = new BufferedReader(new FileReader(logFile));)
- RandomAccessFile (RandomAccessFile accessFile = new RandomAccessFile(logFile.getAbsolutePath(), "r");)
Do both these approaches cause the file to be locked till i call the 'close' method on the BufferedReader/RandomAccessFile object ?
Are there any other ways (Java) to read a file in such a way that the file is not locked/blocked for other processes/programs ?
PS - in all my searches, I have come across multiple answers/solutions (old and new) to this problem. I just wish to seek clarification/closure on this issue.