DataSource.java
01 /**
02  * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
03  */
04 package net.sourceforge.pmd.util.datasource;
05 
06 import java.io.IOException;
07 import java.io.InputStream;
08 
09 /**
10  * Represents a source file to be analyzed.
11  * Different implementations can get the source file
12  * from different places: the filesystem, a zip or jar file, etc.
13  */
14 public interface DataSource {
15     /**
16      * Get an InputStream on the source file.
17      *
18      @return the InputStream reading the source file
19      @throws IOException if the file can't be opened
20      */
21     InputStream getInputStream() throws IOException;
22 
23     /**
24      * Return a nice version of the filename.
25      *
26      @param shortNames    true if short names are being used
27      @param inputFileName name of a "master" file this file is relative to
28      @return String
29      */
30     String getNiceFileName(boolean shortNames, String inputFileName);
31 }