Class ClassPathResource
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.ClassPathResource
-
-
Constructor Summary
Constructors Constructor Description ClassPathResource(String path)Constructs a newClassPathResourcewith the specified resource name.ClassPathResource(String path, ClassLoader classLoader)Constructs a newClassPathResourcewith the specified resource name and class loader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)booleanexists()Tests whether a resource exists.Optional<String>getFileName()Gets the file name of this resource.InputStreamgetInputStream()Open anInputStreamfor the underlying resource.OutputStreamgetOutputStream()Open anOutputStreamfor the underlying resource.StringgetPath()Gets the path.inthashCode()booleanisReadable()Tests whether a resource is readable.booleanisWritable()Tests whether a resource is writable.StringtoString()URLtoURL()Gets aURLto the underlying resource.
-
-
-
Constructor Detail
-
ClassPathResource
public ClassPathResource(String path)
Constructs a newClassPathResourcewith the specified resource name.- Parameters:
path- the resource name
-
ClassPathResource
public ClassPathResource(String path, ClassLoader classLoader)
Constructs a newClassPathResourcewith the specified resource name and class loader.- Parameters:
path- the resource pathclassLoader- class loader used to load a resource
-
-
Method Detail
-
getFileName
public Optional<String> getFileName()
Description copied from interface:ResourceGets the file name of this resource.- Specified by:
getFileNamein interfaceResource- Returns:
- the name of this Resource.
-
exists
public boolean exists()
Description copied from interface:ResourceTests whether a resource exists.
-
isWritable
public boolean isWritable()
Description copied from interface:ResourceTests whether a resource is writable.- Specified by:
isWritablein interfaceResource- Returns:
trueif the resource exists and is writable
-
isReadable
public boolean isReadable()
Description copied from interface:ResourceTests whether a resource is readable.- Specified by:
isReadablein interfaceResource- Returns:
trueif the resource exists and is readable
-
getInputStream
public InputStream getInputStream() throws IOException
Description copied from interface:ResourceOpen anInputStreamfor the underlying resource.- Specified by:
getInputStreamin interfaceResource- Returns:
- the input stream for the resource
- Throws:
IOException- if resource does not exist or an I/O error occurs
-
getOutputStream
public OutputStream getOutputStream() throws IOException
Description copied from interface:ResourceOpen anOutputStreamfor the underlying resource.- Specified by:
getOutputStreamin interfaceResource- Returns:
- the output stream for the resource
- Throws:
IOException- if resource does not exist or an I/O error occurs
-
toURL
public URL toURL() throws FileNotFoundException
Description copied from interface:ResourceGets aURLto the underlying resource.- Specified by:
toURLin interfaceResource- Returns:
- the URL to the resource
- Throws:
FileNotFoundException
-
getPath
public String getPath()
Gets the path.- Returns:
- the path
-
-