KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ozoneDB > io > stream > ResolvingObjectInputStream


1 // You can redistribute this software and/or modify it under the terms of
2
// the Ozone Core License version 1 published by ozone-db.org.
3
//
4
// The original code and portions created by SMB are
5
// Copyright (C) 1997-@year@ by SMB GmbH. All rights reserved.
6
//
7
// $Id: $
8
package org.ozoneDB.io.stream;
9
10 import java.io.ObjectInputStream JavaDoc;
11 import java.io.InputStream JavaDoc;
12 import java.io.IOException JavaDoc;
13 import java.io.ObjectStreamClass JavaDoc;
14
15 /**
16  * @author Nils Nordman
17  * @author Per Nyfelt
18  */

19 public class ResolvingObjectInputStream extends ObjectInputStream JavaDoc {
20
21   public ResolvingObjectInputStream(InputStream JavaDoc in) throws IOException JavaDoc {
22     super(in);
23   }
24
25   protected Class JavaDoc resolveClass(ObjectStreamClass JavaDoc desc)
26       throws IOException JavaDoc, ClassNotFoundException JavaDoc {
27
28     ClassLoader JavaDoc cl = Thread.currentThread().getContextClassLoader();
29     if (cl != null) {
30       try {
31         return cl.loadClass(desc.getName());
32       }
33       catch (ClassNotFoundException JavaDoc e) {
34       }
35     }
36     return super.resolveClass(desc);
37   }
38 }
39
Popular Tags