1 package be
.nikiroo
.utils
.serial
.server
;
3 import java
.io
.IOException
;
4 import java
.net
.Socket
;
6 import be
.nikiroo
.utils
.Version
;
9 * Class used for the server basic handling.
11 * It represents a single action: a server is expected to execute one action for
16 public class ConnectActionServerObject
extends ConnectActionServer
{
18 * Create a new {@link ConnectActionServerObject} with the current
19 * application version (see {@link Version#getCurrentVersion()}) as the
23 * the socket to bind to
25 public ConnectActionServerObject(Socket s
) {
30 * Create a new {@link ConnectActionServerObject}.
33 * the socket to bind to
37 public ConnectActionServerObject(Socket s
, Version version
) {
42 * Serialise and send the given object to the client.
48 * in case of I/O error
49 * @throws NoSuchFieldException
50 * if the serialised data contains information about a field
51 * which does actually not exist in the class we know of
52 * @throws NoSuchMethodException
53 * if a class described in the serialised data cannot be created
54 * because it is not compatible with this code
55 * @throws ClassNotFoundException
56 * if a class described in the serialised data cannot be found
58 public void send(Object data
) throws IOException
, NoSuchFieldException
,
59 NoSuchMethodException
, ClassNotFoundException
{
60 action
.sendObject(data
);
64 * (Flush the data to the client if needed and) retrieve its answer.
66 * @return the deserialised answer (which can actually be NULL)
69 * in case of I/O error
70 * @throws NoSuchFieldException
71 * if the serialised data contains information about a field
72 * which does actually not exist in the class we know of
73 * @throws NoSuchMethodException
74 * if a class described in the serialised data cannot be created
75 * because it is not compatible with this code
76 * @throws ClassNotFoundException
77 * if a class described in the serialised data cannot be found
78 * @throws java.lang.NullPointerException
79 * if the counter part has no data to send
81 public Object
rec() throws NoSuchFieldException
, NoSuchMethodException
,
82 ClassNotFoundException
, IOException
, java
.lang
.NullPointerException
{
83 return action
.recObject();