Assignment3_Server_xmlrpc/src/service/FileService.java
@Override
	public String uploadFiles(Hashtable<String, byte[]> files) {
		if (files.size() == 0) {
			return "No files to upload!!";
		}
		
		Iterator<Entry<String, byte[]>> it = files.entrySet().iterator();
		while (it.hasNext()) {
			Entry<String, byte[]> entry = it.next();
			String fileName = entry.getKey().substring(0, entry.getKey().indexOf("."));
			String fileExtension = entry.getKey().substring(entry.getKey().indexOf(".") + 1);
			String retMsg = uploadFile(fileName, fileExtension, entry.getValue());
			
			// If an exception is thrown from uploadFile()
			if (!Objects.equals(retMsg, "Upload successful!")) {
				return retMsg + " at file: " + entry.getKey();
			}
			
			System.out.println(fileName);
			System.out.println(fileExtension);
		}
		
		return "Upload successful!";
	}
/**
	 * Upload multiple files to a dirPath on the Server specified by Client. 
	 * @param files A hashtable contains file names & bytes of that file. File name must include extension!
	 * @return a message informs that the operation was successful, else an exception message returned from {@link #uploadFile(String, String, byte[])}
	 */
Upload multiple files to a dirPath on the Server specified by Client.
@param files A hashtable contains file names & bytes of that file. File name must include extension.
@return a message informs that the operation was successful, else an exception message returned from  #uploadFile(String, String, byte[])
Upload multiple files to a dirPath on the Server specified by Client . @param files A hashtable contains file names & bytes of that file . File name must include extension . @return a message informs that the operation was successful else an exception message returned from #uploadFile ( String String byte [] )
@Override
	public String uploadFiles(Hashtable<String, byte[]> files) {
		if (files.size() == 0) {
			return "No files to upload!!";
		}
		Iterator<Entry<String, byte[]>> it = files.entrySet().iterator();
		while (it.hasNext()) {
			Entry<String, byte[]> entry = it.next();
			String fileName = entry.getKey().substring(0, entry.getKey().indexOf("."));
			String fileExtension = entry.getKey().substring(entry.getKey().indexOf(".") + 1);
			String retMsg = uploadFile(fileName, fileExtension, entry.getValue());
			if (!Objects.equals(retMsg, "Upload successful!")) {
				return retMsg + " at file: " + entry.getKey();
			}
			System.out.println(fileName);
			System.out.println(fileExtension);
		}
		return "Upload successful!";
	}
@ Override public String uploadFiles ( Hashtable < String , byte [ ] > files ) { if ( files . size ( ) == 0 ) { return "No files to upload!!" ; } Iterator < Entry < String , byte [ ] > > it = files . entrySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { Entry < String , byte [ ] > entry = it . next ( ) ; String fileName = entry . getKey ( ) . substring ( 0 , entry . getKey ( ) . indexOf ( "." ) ) ; String fileExtension = entry . getKey ( ) . substring ( entry . getKey ( ) . indexOf ( "." ) + 1 ) ; String retMsg = uploadFile ( fileName , fileExtension , entry . getValue ( ) ) ; if ( ! Objects . equals ( retMsg , "Upload successful!" ) ) { return retMsg + " at file: " + entry . getKey ( ) ; } System . out . println ( fileName ) ; System . out . println ( fileExtension ) ; } return "Upload successful!" ; }
Upload multiple files to a dirPath on the Server specified by Client.
Upload multiple files to a dirPath on the Server specified by Client .
// If an exception is thrown from uploadFile()