KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > collections > list > AbstractSerializableListDecorator


1 /*
2  * Copyright 2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.collections.list;
17
18 import java.io.IOException JavaDoc;
19 import java.io.ObjectInputStream JavaDoc;
20 import java.io.ObjectOutputStream JavaDoc;
21 import java.io.Serializable JavaDoc;
22 import java.util.Collection JavaDoc;
23 import java.util.List JavaDoc;
24
25 /**
26  * Serializable subclass of AbstractListDecorator.
27  *
28  * @author Stephen Colebourne
29  * @since Commons Collections 3.1
30  */

31 public abstract class AbstractSerializableListDecorator
32         extends AbstractListDecorator
33         implements Serializable JavaDoc {
34
35     /** Serialization version */
36     private static final long serialVersionUID = 2684959196747496299L;
37
38     /**
39      * Constructor.
40      */

41     protected AbstractSerializableListDecorator(List JavaDoc list) {
42         super(list);
43     }
44
45     //-----------------------------------------------------------------------
46
/**
47      * Write the list out using a custom routine.
48      *
49      * @param out the output stream
50      * @throws IOException
51      */

52     private void writeObject(ObjectOutputStream JavaDoc out) throws IOException JavaDoc {
53         out.defaultWriteObject();
54         out.writeObject(collection);
55     }
56
57     /**
58      * Read the list in using a custom routine.
59      *
60      * @param in the input stream
61      * @throws IOException
62      * @throws ClassNotFoundException
63      */

64     private void readObject(ObjectInputStream JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc {
65         in.defaultReadObject();
66         collection = (Collection JavaDoc) in.readObject();
67     }
68
69 }
70
Popular Tags