Package org.biojava.utils.io
Class InputStreamProvider
- java.lang.Object
-
- org.biojava.utils.io.InputStreamProvider
-
public class InputStreamProvider extends Object
A class that provides an InputStream from a File. The file can be compressed or uncompressed. Currently supported compressions:- Gzip (extension .gz)
- Zip (extension .zip) in this case a stream to the first entry in the zip file is returned
- Jar (extension .jar) same as .Zip; only stream to first entry is returned
- Z (extension .Z) compressed using the unix compress command
- for any other extension, no compression is assumed
- Since:
- 1.5
- Version:
- %I% %G%
- Author:
- Andreas Prlic
-
-
Field Summary
Fields Modifier and Type Field Description static String
CACHE_PROPERTY
static int
GZIP_MAGIC
The magic number found at the start of a GZIP stream.
-
Constructor Summary
Constructors Constructor Description InputStreamProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
getInputStream(File f)
get an InputStream for the fileInputStream
getInputStream(String pathToFile)
get an InputStream for this fileInputStream
getInputStream(URL u)
-
-
-
Field Detail
-
GZIP_MAGIC
public static final int GZIP_MAGIC
The magic number found at the start of a GZIP stream.- See Also:
- Constant Field Values
-
CACHE_PROPERTY
public static final String CACHE_PROPERTY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
InputStreamProvider
public InputStreamProvider()
-
-
Method Detail
-
getInputStream
public InputStream getInputStream(String pathToFile) throws IOException
get an InputStream for this file- Parameters:
pathToFile
- the path of the file.- Returns:
- an InputStream for the file located at the path.
- Throws:
IOException
-
getInputStream
public InputStream getInputStream(URL u) throws IOException
- Throws:
IOException
-
getInputStream
public InputStream getInputStream(File f) throws IOException
get an InputStream for the file- Parameters:
f
- a File- Returns:
- an InputStream for the file
- Throws:
IOException
-
-