Here you can find the source of isSerializable(Object o)
public static boolean isSerializable(Object o)
//package com.java2s; /******************************************************************************* * Copyright (c) 2015 Composent, Inc. and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors://w w w . j a v a 2s. c o m * Composent, Inc. - initial API and implementation ******************************************************************************/ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static boolean isSerializable(Object o) { ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(new ByteArrayOutputStream()); oos.writeObject(o); return true; } catch (IOException e) { return false; } finally { try { if (oos != null) oos.close(); } catch (IOException e) { // do nothing } } } }