File tree 1 file changed +10
-10
lines changed
DISTRIBUTED ALGORITHMS/ObjectSerialization(Car scanner)
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 1
1
# Explanation:
2
- Serialization: Converting an object into a byte stream to send it over the network or to save it to a file.
3
- Deserialization: Converting the byte stream back into an object.
2
+ - ** Serialization: Converting an object into a byte stream to send it over the network or to save it to a file.
3
+ - ** Deserialization: Converting the byte stream back into an object.
4
4
5
5
# Serializing an Object:
6
- Obtain the output stream from the socket to send data to the client.
7
- Create an ObjectOutputStream from the output stream.
8
- Create an instance of the object you want to serialize (e.g., car).
9
- Write the object to the ObjectOutputStream using the writeObject() method.
6
+ - ** Obtain the output stream from the socket to send data to the client.
7
+ - ** Create an ObjectOutputStream from the output stream.
8
+ - ** Create an instance of the object you want to serialize (e.g., car).
9
+ - ** Write the object to the ObjectOutputStream using the writeObject() method.
10
10
11
11
# Deserializing an Object:
12
- Obtain the input stream from the socket to receive data from the client.
13
- Create an ObjectInputStream from the input stream.
14
- Read the object from the ObjectInputStream using the readObject() method.
15
- Cast the read object to the appropriate type (e.g., car).
12
+ - ** Obtain the input stream from the socket to receive data from the client.
13
+ - ** Create an ObjectInputStream from the input stream.
14
+ - ** Read the object from the ObjectInputStream using the readObject() method.
15
+ - ** Cast the read object to the appropriate type (e.g., car).
You can’t perform that action at this time.
0 commit comments