Как отключить ajaxtoolkit CollapsiblePanelExtender со стороны клиента?

Вы должны сначала записать заголовок потока с помощью обычного объекта ObjectOutputStream, иначе вы получите java.io.StreamCorruptedException при открытии файла с ObjectInputStream.

public class Test1 implements Serializable {

    public static void main(String[] args) throws Exception {
        ObjectOutputStream os1 = new ObjectOutputStream(new FileOutputStream("test"));
        os1.writeObject(new Test1());
        os1.close();

        ObjectOutputStream os2 = new ObjectOutputStream(new FileOutputStream("test", true)) {
            protected void writeStreamHeader() throws IOException {
                reset();
            }
        };

        os2.writeObject(new Test1());
        os2.close();

        ObjectInputStream is = new ObjectInputStream(new FileInputStream("test"));
        System.out.println(is.readObject());
        System.out.println(is.readObject());
1
задан Kibbee 21 June 2011 в 01:28
поделиться