Is it possible to access the same file and manipulate it from different working processes/thread at the same time?
If i open a file using the next code for example:
public static void main(String[] args){
String dir = System.getProperty("user.dir");
String path = dir + "/rfa.txt";
try {
RandomAccessFile file = new RandomAccessFile(path, "rw");
file.seek(0);
file.write("Hello world".getBytes());
System.out.println(new String(bt));
file.seek(30);
file.write("Goodbye world".getBytes());
file.close();
}
catch (FileNotFoundException ex) {ex.printStackTrace();}
catch (IOException ex) {ex.printStackTrace();}
}
and i am running in a loop constantly. Can i open the same file from a different application and manipulate the data inside (read it or write new stuff), while the file still opened?
thank you for your help.