package com.sister.kelompok5;

import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RMIClient {

	private void sendMessage(){
        try {			
            /*
             * set to RMI server address and port
             * looking for service named "Echo", call remote method
             */
            Registry registry = LocateRegistry.getRegistry("127.0.0.1", 5000);					
            MessageInterface message = (MessageInterface) registry.lookup("Echo");						
            message.Echo("Hi server ...");			
            System.out.println("Message sent to server");
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }        
    }
    
    public static void main(String[] args) {
        RMIClient main = new RMIClient();
        main.sendMessage();
    }
    
}

@@ -24,16 +24,112 @@
 mpok5;%0A%0A
+import java.awt.image.BufferedImage;%0Aimport java.io.ByteArrayOutputStream;%0Aimport java.io.File;%0A
 import j
@@ -161,16 +161,16 @@
 gistry;%0A
-
 import j
@@ -197,16 +197,47 @@
 istry;%0A%0A
+import javax.imageio.ImageIO;%0A%0A
 public c
@@ -612,67 +612,1438 @@
 up(%22
-Echo%22);%09%09%09%09%09%09%0A            message.Echo(%22Hi server ...%22);%09%09%09
+ConvertColor%22);%0A            %0A            // Full file path%0A            String imagePath = %22%22;%0A            File path = new File(imagePath);%0A            %0A            // File list%0A            String%5B%5D files = path.list();%0A            %0A            // Number of files%0A            int numOfFiles = files.length;%0A            %0A            // Initialize byte array%0A            byte%5B%5D images;%0A            %0A            for (int i = 0; i %3C numOfFiles; i++) %7B%0A            %09// Image file will send to server%0A            %09String fileIndex = files%5Bi%5D;%0A            %09File sendFile = new File(imagePath + %22/%22 + fileIndex);%0A            %09%0A            %09// Using regex to remove file extensions%0A            %09String fileName = fileIndex.replaceFirst(%22%5B.%5D%5B%5E.%5D+$%22, %22%22);%0A            %09%0A            %09// Get file extesions%0A            %09String fileExtension = fileIndex.substring(fileIndex.lastIndexOf('.')+1);%0A            %09%0A            %09BufferedImage img = ImageIO.read(sendFile);%0A            %09%0A            %09ByteArrayOutputStream baos = new ByteArrayOutputStream();%0A            %09ImageIO.write(img, fileExtension, baos);%0A            %09images = new byte%5Bbaos.size()%5D;%0A            %09images = baos.toByteArray();%0A            %09%0A            %09int fileNumber = i + 1;%0A            %09%0A            %09// Call method to start converting color%0A            %09message.Convert(images, fileNumber, fileName, fileExtension);%0A            %09%0A            %09// Printing message reply as log
 %0A   
@@ -2043,32 +2043,33 @@
 log%0A            
+%09
 System.out.print
@@ -2076,33 +2076,218 @@
 ln(%22
-Message sent to server%22);
+Ukuran byte array: %22 + images.length);%0A    %09%09%09System.out.println(%22Ukuran file: %22 + sendFile.length());%0A    %09%09%09System.out.println(fileNumber + %22. %22 + fileName + %22 berhasil dikirim%5Cn%22);%0A            %7D%0A            
 %0A   

read image files