It's not a secret anymore!
The moose likes I/O and Streams and the fly likes RMI  file service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "RMI  file service" Watch "RMI  file service" New topic

RMI file service

Andrew Winton

Joined: Oct 29, 2004
Posts: 3
Trying to create a remote file service using RMI. How can i allow clients to odtain a list of file names from the dir and also obtain the content of a specified file???

Hope someone can help!
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

Take a look at the class and the various InputStream/OutputStream and Reader/Writer classes provided in the package also. The File class can be used on files or directories... File.list() returns an array of filenames if the File object is a directory. You would then open a FileInputStream or a FileReader, depending on whether you wanted to read binary or character information from the file.

Even though you may be doing this over RMI, this question involves just plain old Java file io, so I'll move this to the "I/O and Streams" forum.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: RMI file service
It's not a secret anymore!