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