(New page: <source lang="java"> public static Object convertByteArrayToObject(byte[] stream) { java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(stream); java.io.ObjectInputStrea...) |
|||
Line 17: | Line 17: | ||
} | } | ||
return obj; | return obj; | ||
+ | } | ||
+ | |||
+ | public static void printErr(java.lang.Exception ex) { | ||
+ | printErr(ex.getMessage()); | ||
} | } | ||
</source> | </source> |
Latest revision as of 04:08, 23 November 2010
public static Object convertByteArrayToObject(byte[] stream) { java.io.ByteArrayInputStream bais = new java.io.ByteArrayInputStream(stream); java.io.ObjectInputStream ois = null; Object obj = null; try { ois = new java.io.ObjectInputStream(bais); try { obj = ois.readObject(); } catch (ClassNotFoundException ex) { Ts.printErr(ex); } ois.close(); bais.close(); } catch (java.io.IOException ex) { Ts.printErr(ex); } return obj; } public static void printErr(java.lang.Exception ex) { printErr(ex.getMessage()); }