你是用串行化對象吧?
把對象寫到流中
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
oo.writeObject(YourClass);用Socket傳到客戶端後﹐讀出對象
ByteArrayInputStream bi = new ByteArrayInputStream(to.toByteArray());
ObjectInputStream oi = new ObjectInputStream(bi);
YourClassType YourClass = (YourClassType)oi.readObject();