Showing posts with label JAVA. Show all posts
Showing posts with label JAVA. Show all posts

Saturday, February 13

RPC Sample code in Java

Hello friends, In this post we will see how RPC (Remote Procedure Call) mechanism can be implemented in Java. RMI (Remote Method Invocation)  is the special mechanism to do  RPC in Java. RMI is the java flavor of RPC in other languages, but core concept is still same! The main Idea is summarized as below:  In this example, we make a server (RMIServer.java) to receive input text from client application and replies how many characters it received. Server Side: Create a remote interface. (myInterface.java) Create a separate java file to implement the remote interface. (RMIServer.java) Register...

Monday, January 16

COMPRESS A FILE INTO .gz FILE ~ COMPLETE JAVA CODE

Hello friends, In this post I’m presenting a java code to compress a file into -.gz format. Hope this will be useful to you..!!! Algorithm1.      1.Input the name of the file to be zipped. 2.      Create an OutputStream in the name of given _file.gz. 3.      Point it to the GZIPOutputStream. 4.       Read from the file to be zipped, bytewise, and write it into GZIPOutputStream. import java.io.*;import java.util.zip.*;public class CompressFile {public static void compresser(String temp) {try {File file = new File(temp);FileOutputStream...

Tuesday, December 20

Develop a Simple Game in Java - Complete code

Hi Friends,Here I’m posting about my first Java game  ~ HitME..!!! Through this post you will understand about:·         Concept of Java Threads.·         Codes for Jframe and other components.·         Java code to close a window.·         Actions related to Buttons and Button Array.·         Random Number generation in Java.HitME is the Java game in which several Buttons will be provided within  a frame. To win the game, you have to...