|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgov.llnl.ontology.util.StreamUtil
public class StreamUtil
This collects a set of commonly used methods accessing data streams and files in and outside of running jars.
Constructor Summary | |
---|---|
StreamUtil()
|
Method Summary | |
---|---|
static File |
fileFromJar(Class c,
String filePath)
Returns a File object associated with filePath located
within the current running jar that has loaded Class c . |
static InputStream |
fromJar(Class c,
String filePath)
Returns an InputStream corresponding to the the file denoted by
filePath . |
static InputStream |
fromPath(String filePath)
Returns a InputStream corresponding to the absolute path name
denoted by filePath . |
static DataInputStream |
gzipInputStream(InputStream in)
Returns a DataInputStream for reading object data from a gzipped
InputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StreamUtil()
Method Detail |
---|
public static InputStream fromJar(Class c, String filePath)
InputStream
corresponding to the the file denoted by
filePath
. It will be read from the current set of class
resources accessible by the given running class's classpath. This
classpath has access to not only local files via an absolute path, but
also files embedded within a jar.
c
- The current Class
that requires a resourcefilePath
- The name of the file which should be read
InputStream
for data in filePath
public static InputStream fromPath(String filePath)
InputStream
corresponding to the absolute path name
denoted by filePath
. This will not access any files within the
currently running jar or class path.
filePath
- The name of the file which should be read
InputStream
for data in filePath
public static File fileFromJar(Class c, String filePath)
File
object associated with filePath
located
within the current running jar that has loaded Class
c
.
The returned File
cannot be read directly but my contain valuable
meta data.
c
- The current Class
that requires a resourcefilePath
- The name of the file which should be opened
File
for data in filePath
public static DataInputStream gzipInputStream(InputStream in)
DataInputStream
for reading object data from a gzipped
InputStream
.
in
- An existing InputStream
whose data is in the gzipped
format
DataInputStream
for reading data from the gzipped
stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |