what is the library should I use ? what are the functions that help me?
The easiest way is probably using serialization. Therefore, your object classes must implement serializable, so do have all of the members (primitves and most of the standard java classes already do this). This allows the mapping between object instances and byte streams at runtime.
You also need a protocol for transer. You can have a look at RMI, if you don't want to deal with streaming you byte streams over the wire, though this is not that difficult. Using RMI however allows you build more powerful distributed java applications later.