serialization in java

soidi

New member
serialization in java

אני לא מצליח להעביר קבצים שלמים רק טיפוסים בסיסים הקוד שלי הוא : **********הלקוח***************** FileOutputStream fi=new FileOutputStream(file); Socket s = new Socket("localhost", port); ObjectOutputStream oos = new ObjectOutputStream (s.getOutputStream()); oos.writeObject(obj); //some obj, say a simple String oos.flush(); ObjectInputStream ois = new ObjectInputStream (s.getInputStream()); try { file = (File)ois.readObject(); ******ב שרת********************** ObjectInputStream ois = new ObjectInputStream (s.getInputStream()); ObjectOutputStream oos = new ObjectOutputStream (s.getOutputStream()); try { String obj = (String)ois.readObject(); System.out.println( obj) ; } catch (ClassNotFoundException e) { e.printStackTrace(); //To change body of catch statement use Options | File Templates. } ( FileOutputStream fo= new FileOutputStream("2.txt הוא זורק לי notserializableexception אם למישהו יש דרך להעביר קבצים שלמיםמ בג'אווה זה יעזור לאללה תודה
 
למעלה