001 /*
002 * SonarQube, open source software quality management tool.
003 * Copyright (C) 2008-2014 SonarSource
004 * mailto:contact AT sonarsource DOT com
005 *
006 * SonarQube 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 3 of the License, or (at your option) any later version.
010 *
011 * SonarQube 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 License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
019 */
020 package org.sonar.api.resources;
021
022 import java.io.File;
023 import java.io.FileNotFoundException;
024 import java.io.InputStream;
025
026 /**
027 * @since 2.6
028 * @deprecated in 4.2. Replaced by {@link org.sonar.api.batch.fs.InputFile}
029 */
030 @Deprecated
031 public interface InputFile {
032 /**
033 * The source base directory, different than the project basedir.
034 *
035 * <p>For example in maven projects, the basedir of a source file stored in
036 * <code>src/main/java/org/foo/</code> is the directory <code>src/main/java</code>.</p>
037 */
038 File getFileBaseDir();
039
040 /**
041 * Get the underlying file.
042 *
043 * @return the file
044 */
045 File getFile();
046
047 /**
048 * Path relative to basedir. Directory separator is slash <code>'/'</code>, whatever the platform.
049 *
050 * <p>Example on windows: if file basedir is <code>c:\project\src\</code> and file is <code>c:\project\src\org\foo\Bar.java</code>, then relative path
051 * is <code>org/foo/Bar.java</code></p>
052 *
053 * <p>Example on unix: if file basedir is <code>/project/src</code> and file is <code>/project/src/org/foo/Bar.java</code>, then relative path
054 * is <code>org/foo/Bar.java</code> as well.</p>
055 */
056 String getRelativePath();
057
058 /**
059 * Get an {@link InputStream} that reads from the file.
060 *
061 * <p>The returned stream is buffered so there is no need to use a
062 * <code>BufferedInputStream</code></p>
063 *
064 * @return the stream
065 * @throws FileNotFoundException if the file is not found
066 * @since 3.1
067 */
068 InputStream getInputStream() throws FileNotFoundException;
069 }