Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RMI file service  RSS feed

 
Andrew Winton
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at the java.io.File class and the various InputStream/OutputStream and Reader/Writer classes provided in the java.io 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.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!