1 /* 2 * Copyright (C) 2009,2010 Matthias Treydte <mt (at) waldheinz.de> 3 * 4 * This library is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Lesser General Public License as published 6 * by the Free Software Foundation; either version 2.1 of the License, or 7 * (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, but 10 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 12 * License for more details. 13 * 14 * You should have received a copy of the GNU Lesser General Public License 15 * along with this library; If not, write to the Free Software Foundation, Inc., 16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 19 package de.waldheinz.fs.fat; 20 21 import java.io.IOException; 22 23 /** 24 * Gets thrown when either 25 * <ul> 26 * <li>a {@link Fat16RootDirectory} becomes full or</li> 27 * <li>a {@link ClusterChainDirectory} grows beyond it's 28 * {@link ClusterChainDirectory#MAX_SIZE maximum size} 29 * </ul> 30 * 31 * @author Matthias Treydte <waldheinz at gmail.com> 32 */ 33 public final class DirectoryFullException extends IOException { 34 private final static long serialVersionUID = 2; 35 private final int currentCapacity; 36 private final int requestedCapacity; 37 38 DirectoryFullException(int currentCapacity, int requestedCapacity) { 39 this("directory is full", currentCapacity, requestedCapacity); 40 } 41 42 DirectoryFullException(String message, 43 int currentCapacity, int requestedCapacity) { 44 45 super(message); 46 47 this.currentCapacity = currentCapacity; 48 this.requestedCapacity = requestedCapacity; 49 } 50 51 /** 52 * Returns the current capacity of the directory. 53 * 54 * @return the current capacity 55 */ 56 public int getCurrentCapacity() { 57 return currentCapacity; 58 } 59 60 /** 61 * Returns the capacity the directory tried to grow, which did not succeed. 62 * 63 * @return the requested capacity 64 */ 65 public int getRequestedCapacity() { 66 return requestedCapacity; 67 } 68 69 } 70