1 package net.sourceforge.simplegamenet.framework.transport; 2 3 import java.io.IOException; 4 import java.io.InputStream; 5 import java.io.ObjectInputStream; 6 import java.io.ObjectStreamClass; 7 8 public class GamesObjectInputStream extends ObjectInputStream { 9 10 private ClassLoader gamesClassLoader; 11 12 public GamesObjectInputStream(InputStream in, ClassLoader gamesClassLoader) 13 throws IOException { 14 super(in); 15 this.gamesClassLoader = gamesClassLoader; 16 } 17 18 protected Class resolveClass(ObjectStreamClass desc) throws IOException, 19 ClassNotFoundException { 20 try { 21 return super.resolveClass(desc); 22 } catch (ClassNotFoundException exception) { 23 return Class.forName(desc.getName(), false, gamesClassLoader); 24 } 25 } 26 27 }