/**
* 序列化
*
* @throws Exception
*/
public String OutputStream(List> results) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ObjectOutputStream objectOutputStream = new ObjectOutputStream(
byteArrayOutputStream);
objectOutputStream.writeObject(results);
String serStr = byteArrayOutputStream.toString("ISO-8859-1");
serStr = java.net.URLEncoder.encode(serStr, "UTF-8");
objectOutputStream.close();
byteArrayOutputStream.close();
System.out.println(serStr);
return serStr;
}
/**
* 反序列化
*
* @throws Exception
*/
public List> InputStream(String serStr) throws Exception {
String redStr = java.net.URLDecoder.decode(serStr, "UTF-8");
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
redStr.getBytes("ISO-8859-1"));
ObjectInputStream objectInputStream = new ObjectInputStream(
byteArrayInputStream);
List> results = (List>) objectInputStream.readObject();
objectInputStream.close();
byteArrayInputStream.close();
return results;
}