Java tutorial
package com.web.server.node; /*Copyright 2013 - 2015, Arun_Soundararajan (arun_srajan_2007@yahoo.com).and/or its affiliates. All files in this repository or distribution are licensed under the Apache License, Version 2.0 (the "License"); you may not use any files in this repository or distribution except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.*/ import java.io.IOException; import java.io.InputStream; import java.io.ObjectStreamClass; import java.io.StreamCorruptedException; import org.apache.commons.io.input.ClassLoaderObjectInputStream; public class NodeObjectInputStream extends ClassLoaderObjectInputStream { public NodeObjectInputStream(ClassLoader classLoader, InputStream inputStream) throws IOException, StreamCorruptedException { super(classLoader, inputStream); // TODO Auto-generated constructor stub } public Class resolveClass(ObjectStreamClass desc) throws ClassNotFoundException, IOException { try { return super.resolveClass(desc); } catch (ClassNotFoundException e) { if (desc.getName().equals("int")) return int.class; else if (desc.getName().equals("float")) { return float.class; } else if (desc.getName().equals("double")) { return double.class; } else if (desc.getName().equals("long")) { return long.class; } else if (desc.getName().equals("boolean")) { return boolean.class; } } return null; } }