Class FileSystemResource
- java.lang.Object
-
- com.github.nosan.embedded.cassandra.commons.FileSystemResource
-
-
Constructor Summary
Constructors Constructor Description FileSystemResource(File file)Constructs a newFileSystemResourcewith the specifiedFile.FileSystemResource(Path file)Constructs a newFileSystemResourcewith the specifiedPath.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object other)booleanexists()Tests whether a resource exists.PathgetFile()Gets the file.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()URItoURI()Gets aURIto the underlying resource.URLtoURL()Gets aURLto the underlying resource.
-
-
-
Constructor Detail
-
FileSystemResource
public FileSystemResource(Path file)
Constructs a newFileSystemResourcewith the specifiedPath.- Parameters:
file- thePath
-
FileSystemResource
public FileSystemResource(File file)
Constructs a newFileSystemResourcewith the specifiedFile.- Parameters:
file- theFile
-
-
Method Detail
-
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 MalformedURLException
Description copied from interface:ResourceGets aURLto the underlying resource.- Specified by:
toURLin interfaceResource- Returns:
- the URL to the resource
- Throws:
MalformedURLException
-
toURI
public URI toURI()
Description copied from interface:ResourceGets aURIto the underlying resource.
-
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
-
getFile
public Path getFile()
Gets the file.- Returns:
- the file
-
-