Class ZipDataSource
- java.lang.Object
-
- net.sourceforge.pmd.util.datasource.internal.AbstractDataSource
-
- net.sourceforge.pmd.util.datasource.ZipDataSource
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,DataSource
public class ZipDataSource extends net.sourceforge.pmd.util.datasource.internal.AbstractDataSource
DataSource implementation to read data from an entry in a zip or jar file.
-
-
Constructor Summary
Constructors Constructor Description ZipDataSource(ZipFile zipFile, ZipEntry zipEntry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
boolean
equals(Object obj)
InputStream
getInputStream()
Get an InputStream on the source file.String
getNiceFileName(boolean shortNames, String inputFileName)
Return a nice version of the filename.int
hashCode()
String
toString()
-
-
-
Method Detail
-
getInputStream
public InputStream getInputStream() throws IOException
Description copied from interface:DataSource
Get an InputStream on the source file.- Returns:
- the InputStream reading the source file
- Throws:
IOException
- if the file can't be opened
-
getNiceFileName
public String getNiceFileName(boolean shortNames, String inputFileName)
Description copied from interface:DataSource
Return a nice version of the filename.- Parameters:
shortNames
- true if short names are being usedinputFileName
- name of a "master" file this file is relative to- Returns:
- String
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classnet.sourceforge.pmd.util.datasource.internal.AbstractDataSource
- Throws:
IOException
-
-