blob: 3e7609d60ec657537ba5cbb763961b07b5298dfd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* NetCalendar 2006, 2009 (c) Dipl.-Inform. (FH) Paul C. Buetow
* http://netcalendar.buetow.org - netcalendar@dev.buetow.org
*/
package shared.remotecall;
import java.io.*;
/**
* This is the abstract base class of all other classes of the shared.remotecall package.
* Its defining some common methods.
* @author Paul C. Buetow
*
*/
public abstract class RemoteCall {
/**
* This is a help method for writeObject of the child classes, needed for ojbect serialization (sending part).
* It checks if object is defined. If yes, it will be written to the given object output stream with a leading
* flag with the value true. Otherwise only the false flag will be written to the object output stream.
* @param objectOutputStream Specifies the output stream.
* @throws IOException
*/
protected final void writeObjectIfDefined(ObjectOutputStream objectOutputStream, Object object)
throws IOException {
if (object == null) {
objectOutputStream.writeBoolean(false);
} else {
objectOutputStream.writeBoolean(true);
objectOutputStream.writeObject(object);
}
}
}
|