나는 당신이 어떤 잠재적 인 문제를 배제하기 위해 로컬로 먼저 객체를 직렬화 할 수 있는지 확인 것 ... 잘 작동하는 것 같다 다음 코드로
그것을 테스트했습니다. 당신은 여전히 소켓을 통해로드 할 수없는 경우, 다음 소켓 코드는
또한
public class TestSerialisation {
public static void main(String[] args) {
new TestSerialisation();
}
public TestSerialisation() {
ObjectOutputStream oos = null;
ObjectInputStream ois = null;
Wrapper out = new Wrapper();
System.out.println("Before = " + out.dump());
try {
try {
oos = new ObjectOutputStream(new FileOutputStream(new File("Test.out")));
oos.writeObject(out);
} finally {
try {
oos.close();
} catch (Exception e) {
}
}
Wrapper in = null;
try {
ois = new ObjectInputStream(new FileInputStream(new File("Test.out")));
in = (Wrapper) ois.readObject();
} finally {
try {
ois.close();
} catch (Exception e) {
}
}
System.out.println("After = " + (in == null ? "null" : in.dump()));
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
public static class Wrapper implements Serializable {
private JTextArea textArea;
public Wrapper() {
textArea = new JTextArea("I'm some text");
}
public String dump() {
return textArea.getText();
}
}
}
자바의 호환 버전을 실행하고 있는지 확인이 (내 기억이 제대로 날 서비스를 제공하는 경우가 아닌 직렬화, 결함이) 양쪽 끝에 직렬화 된 객체의 호환 버전이 있습니다.
코드를 전송하는 방법을 게시하십시오. – Mordechai
ObjectOutputStream을 사용하여 전송합니다. 내가 뭘 원하는 건 jta serializable을 만드는 것입니다. – Barakados
글쎄, 난 그냥 문제를 추측 할 수 없다, 코드를 게시, 도움이 될 수도 있습니다. 모든 스윙 컴포넌트를 직렬화 할 수 있습니다. – Mordechai