001    /*
002     *  jDTAUS Core API
003     *  Copyright (c) 2005 Christian Schulte
004     *
005     *  Christian Schulte, Haldener Strasse 72, 58095 Hagen, Germany
006     *  <schulte2005@users.sourceforge.net> (+49 2331 3543887)
007     *
008     *  This library is free software; you can redistribute it and/or
009     *  modify it under the terms of the GNU Lesser General Public
010     *  License as published by the Free Software Foundation; either
011     *  version 2.1 of the License, or any later version.
012     *
013     *  This library is distributed in the hope that it will be useful,
014     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
015     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016     *  Lesser General Public License for more details.
017     *
018     *  You should have received a copy of the GNU Lesser General Public
019     *  License along with this library; if not, write to the Free Software
020     *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
021     *
022     */
023    package org.jdtaus.core.io;
024    
025    import java.io.IOException;
026    import java.util.EventListener;
027    
028    /**
029     * Listener for structural changes of {@code StructuredFile}s.
030     *
031     * @author <a href="mailto:schulte2005@users.sourceforge.net">Christian Schulte</a>
032     * @version $Id: StructuredFileListener.java 8044 2009-07-02 01:29:05Z schulte2005 $
033     */
034    public interface StructuredFileListener extends EventListener
035    {
036        //--StructuredFileListener--------------------------------------------------
037    
038        /**
039         * Gets called whenever blocks were inserted into the {@code StructuredFile}
040         * the listener is registered with. The block previously at {@code index}
041         * will have moved to {@code index + insertedBlocks}.
042         *
043         * @param index the index of the first inserted block.
044         * @param insertedBlocks the number of blocks which were inserted at
045         * {@code index}.
046         *
047         * @throws IOException if reading or writing fails.
048         */
049        void blocksInserted( long index, long insertedBlocks ) throws IOException;
050    
051        /**
052         * Gets called whenever blocks were deleted from the {@code StructuredFile}
053         * the listener is registered with. The block previously at
054         * {@code index + deletedBlocks} will have moved to {@code index}.
055         *
056         * @param index the index of the first deleted block.
057         * @param deletedBlocks the number of blocks which were deleted starting
058         * at {@code index} inclusive.
059         *
060         * @throws IOException if reading or writing fails.
061         */
062        void blocksDeleted( long index, long deletedBlocks ) throws IOException;
063    
064        //--------------------------------------------------StructuredFileListener--
065    }