Class UrlResource
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.UrlResource
-
-
Constructor Summary
Constructors Constructor Description UrlResource(URL url)Constructs a newUrlResourcewith the specified URL.
-
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.inthashCode()booleanisReadable()Tests whether a resource is readable.booleanisWritable()Tests whether a resource is writable.StringtoString()URLtoURL()Gets aURLto the underlying resource.
-
-
-
Constructor Detail
-
UrlResource
public UrlResource(URL url)
Constructs a newUrlResourcewith the specified URL.- Parameters:
url- theURL
-
-
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()
Description copied from interface:ResourceGets aURLto the underlying resource.
-
-