We've made an instant messenger as our school project.
It has methods like getMSg, sendMSG etc. for sending messages from one client to another client.
But we also want to add file-transfer functionality to it.
So here is what I need:
1. Incoming File Transfer Handler: Recieves an Output Stream connected to another client and open file from local hard disk and send file using this output stream.
2. Outgoing File Transfer Handler: Recieves an Input Stream connected to another client and recieves file using this input stream, save it in local hard disk.
3. Supply 2 code fragments to show how to call above two handlers. These code-fragments will be integrated into existing getMSG and sendMSG methods.
To describe code-fragments, let me write pseudocode here:
if incomingMessageStartsWith("/send")
{
call incoming fileHandler(filename, filesize)
reciveFile();
system.out.println"file transfer done");
}