Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java BufferedWriter & OS File move  RSS feed

 
Krishna Uppala Gopi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am writing into File ( loc1 )using BufferedWriter. While this is in progress, by mistake, I moved the file ( which java process is currently writing ) to different location ( loc2 )using Operating system command ( HP Unix ). When I verified, java process is still writing into the file which is located in the new location (loc2). As I want the file to be in ( loc1 ), I moved back using the OS command. The java process is still writing into the file ( in loc1 )

Does any idea how this is possible? Any issues around this?

Regards
Uppala Gopi Krishna
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
You didn't move the file to a different drive or partition.
Therefore the file could stay where it has been, and only the file-allocation-table or something like that need to have an update, that the name of the file in sector 297221 has changed from /foo/bar/xy.file to /bar/foobar/xy.file.

And the process kept writing to the file starting at 297221.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!