I am in the mist of developing an RMI Update utility for clients.  Like
most updaters they would download a small 30k(+-) java application that
would talk to an RMI server and decide what files (.class) the client
needed.  It works like a charm but, the typical but word my classes when
used by the JVM either through security exceptions or are unreadable.  To
transfer the class file we are using the following:

NOTE: FileDataInterface is just an RemoteInterface that returns the
byte array to the client so they may store it in the proper place with the
given name.

    public FileDataInterface getFileData(String packageKey) throws 
RemoteException
    {
        if (m_FileList.containsKey((String)packageKey))
        {
            FileInfo fi = (FileInfo)m_FileList.get((String)packageKey);
            String loc = fi.getLocation();
            System.out.println("Getting file: " + loc);
            try
            {
                DataInputStream di = new DataInputStream(new
FileInputStream(new File(loc)));
                int avail = di.available();
                System.out.println("Available: " + avail);
                byte[] data = new byte[avail];
                di.readFully(data);
                FileData fd = new FileData(data);
                return fd;
            }
            catch (FileNotFoundException fn)
            {
                System.out.println("FileNotFoundException: " + fn);
                return null;   
            }
            catch (IOException io)
            {
                System.out.println("IOException: " + io);
                return null;   
            }
        }
        else
        {
            
            return null;
        }
    }


Is there another way to transfer class files or other files for that
matter across tcpip that will not modify the file layout, just taking raw 
data from one maching to another.  Can anyone see what I might be doing
wrong.

-Bob


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to