1
2
3
4 package de.netseeker.ejoe.adapter;
5
6 import java.io.DataInputStream;
7 import java.io.DataOutputStream;
8 import java.io.IOException;
9 import java.io.InputStream;
10 import java.io.OutputStream;
11
12 /***
13 * Simple raw string (de)Serializer for serializing/deserializing string
14 * messages. This adapter will always use UTF8 encoding.
15 *
16 * @author netseeker
17 */
18 public class UTF8StringAdapter implements SerializeAdapter
19 {
20
21
22
23
24
25 public Object read(InputStream in) throws IOException
26 {
27 return new DataInputStream(in).readUTF();
28 }
29
30
31
32
33
34
35
36 public void write(Object obj, OutputStream out) throws IOException
37 {
38 new DataOutputStream(out).writeUTF(obj.toString());
39 }
40
41
42
43
44
45
46 public void handleClassLoaderChange(ClassLoader classLoader)
47 {
48
49 }
50
51 }