001 package org.LiveGraph.dataFile.write; 002 003 import java.io.File; 004 005 006 /** 007 * Is thrown by {@code DataStreamWriterFactory} to indicate that a {@code DataStreamWriter} 008 * for a specified physical file stream cannot be created becasue the file already 009 * exists and cannot be overwritten. This class subclasses {@code RuntimeException} and 010 * not {@code Exception} in order to allow applications the convenience of not catching 011 * this exception if they have a good enough reason to believe that the data file does 012 * not already exist. 013 * 014 * <p> 015 * <strong>LiveGraph</strong> 016 * (<a href="http://www.live-graph.org" target="_blank">http://www.live-graph.org</a>). 017 * </p> 018 * <p>Copyright (c) 2007-2008 by G. Paperin.</p> 019 * <p>File: DataFileAlreadyExistsException.java</p> 020 * <p style="font-size:smaller;">Redistribution and use in source and binary forms, with or 021 * without modification, are permitted provided that the following terms and conditions are met: 022 * </p> 023 * <p style="font-size:smaller;">1. Redistributions of source code must retain the above 024 * acknowledgement of the LiveGraph project and its web-site, the above copyright notice, 025 * this list of conditions and the following disclaimer.<br /> 026 * 2. Redistributions in binary form must reproduce the above acknowledgement of the 027 * LiveGraph project and its web-site, the above copyright notice, this list of conditions 028 * and the following disclaimer in the documentation and/or other materials provided with 029 * the distribution.<br /> 030 * 3. All advertising materials mentioning features or use of this software or any derived 031 * software must display the following acknowledgement:<br /> 032 * <em>This product includes software developed by the LiveGraph project and its 033 * contributors.<br />(http://www.live-graph.org)</em><br /> 034 * 4. All advertising materials distributed in form of HTML pages or any other technology 035 * permitting active hyper-links that mention features or use of this software or any 036 * derived software must display the acknowledgment specified in condition 3 of this 037 * agreement, and in addition, include a visible and working hyper-link to the LiveGraph 038 * homepage (http://www.live-graph.org). 039 * </p> 040 * <p style="font-size:smaller;">THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY 041 * OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 042 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 043 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 044 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 045 * IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 046 * </p> 047 * 048 * @author Greg Paperin (<a href="http://www.paperin.org" target="_blank">http://www.paperin.org</a>) 049 * @version {@value org.LiveGraph.LiveGraph#version} 050 * 051 */ 052 public class DataFileAlreadyExistsException extends RuntimeException { 053 054 055 /** 056 * Creates a new {@code DataFileAlreadyExistsException} relating to the specified file path. 057 * 058 * @param filePath A file path. 059 */ 060 public DataFileAlreadyExistsException(String filePath) { 061 super("Cannot overwrite file: " + filePath); 062 } 063 064 /** 065 * Creates a new {@code DataFileAlreadyExistsException} relating to the specified file path. 066 * 067 * @param file A file. 068 */ 069 public DataFileAlreadyExistsException(File file) { 070 super("Cannot overwrite file: " + file.getAbsolutePath()); 071 } 072 073 } // public class DataFileAlreadyExistsException