001/* 002 * jDTAUS Core API 003 * Copyright (C) 2005 Christian Schulte 004 * <cs@schulte.it> 005 * 006 * This library is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 2.1 of the License, or any later version. 010 * 011 * This library is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public 017 * License along with this library; if not, write to the Free Software 018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 019 * 020 */ 021package org.jdtaus.core.io; 022 023import java.io.IOException; 024import java.util.EventListener; 025 026/** 027 * Listener for structural changes of {@code StructuredFile}s. 028 * 029 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a> 030 * @version $JDTAUS: StructuredFileListener.java 8641 2012-09-27 06:45:17Z schulte $ 031 */ 032public interface StructuredFileListener extends EventListener 033{ 034 //--StructuredFileListener-------------------------------------------------- 035 036 /** 037 * Gets called whenever blocks were inserted into 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}