Here you can find the source of deserializeFromString(String obj)
public static Object deserializeFromString(String obj) throws IOException, ClassNotFoundException
//package com.java2s; /*/* www .jav a 2 s. c o m*/ * Copyright 2001-2008 Aqris Software AS. All rights reserved. * * This program is dual-licensed under both the Common Development * and Distribution License ("CDDL") and the GNU General Public * License ("GPL"). You may elect to use one or the other of these * licenses. */ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.StringTokenizer; public class Main { public static Object deserializeFromString(String obj) throws IOException, ClassNotFoundException { byte[] b = stringToBytes(obj); ByteArrayInputStream bytes = new ByteArrayInputStream(b); ObjectInputStream stream = new ObjectInputStream(bytes); return stream.readObject(); } private static byte[] stringToBytes(String s) { StringTokenizer tokenizer = new StringTokenizer(s); byte[] result = new byte[tokenizer.countTokens()]; for (int i = 0; i < result.length; i++) { result[i] = Byte.parseByte(tokenizer.nextToken()); } return result; } }