I have a while loop which appends data in a while loop and it closes every time before the end of the loop. Is it possible to sync that file to a server after I close the file and before I end the loop?
//--- Pseudocode
while(1){
writer.append(data1);
writer.append(,);
writer.append(data2);
writer.append(,);
writer.flush(),
// --I need to run a command here that lets me sync the file to the server
}
Im trying to Runtime.exe() after the flush. Will that be a good idea? Will it cause any delay?
If I understand your question correctly, you should just use ProcessBuilder.
But I have not tested this code.
You may run into problems, such as:
scpaccepts a password from standard input.