Monday, January 14, 2002 06:36 AM
In Java, a File Object simply represents a possibly existing file on the file system.
If you create a file object like this:
File f = new File ( "c:\test.txt" );
and the file "c: est.txt" doesn't exist, this will throw no exception (but f.exists ( ) will tell you so).
If you want to work with a file's content, you'll ask an InputStream for it, and only then you'll really access the file.
What you can do to solve your problem, is to read the file on the server side, store it's content (in a String, byte array, or whatever ...) and pass the content to the client.
This has to be done, because the remote machine can't access the local machine's file system.
This can be implemented by putting a method in you remote interface like this:
byte getFileContents ( String fileName ) throws RemoteException;
if you then implement this method on the serverside and return a byte array, you can write a new file on the client side, or keep the data in memory, according to your needs ...