jQuery in Action, 3rd edition
The moose likes I/O and Streams and the fly likes networked file reading and writing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "networked file reading and writing" Watch "networked file reading and writing" New topic

networked file reading and writing

Joseph Siao
Ranch Hand

Joined: Feb 26, 2004
Posts: 32
Is the use of the FileWriter and FileReader object also applicable if Im writing or reading a file from/to a networked computer or a different computer aside from the computer that im running the java code? or do i have to go to socket programming?
Oliver Gibbs

Joined: Apr 27, 2004
Posts: 4
If you are reading and writing a file, the network file system should be transparent to your application since the appropriate layer of the operating system will handle the inner details. So in answer to your question, yes, using a FileWriter and FileReader object for network-based files should be suffice!
Hope this helps!
Jose Botella
Ranch Hand

Joined: Jul 03, 2001
Posts: 2120
Joshep, if you are in LAN is likely that the OS allows you to access files in others computers. If so, FileReader could be used with a file in a shared resource set up previously to the execution of the Java program. But in the Internet we would need socket programming or a FTP client. Look at this post for an example of the former.

SCJP2. Please Indent your code using UBB Code
I agree. Here's the link: http://aspose.com/file-tools
subject: networked file reading and writing
It's not a secret anymore!