public abstract class AbstractResource extends Object implements Resource
Constructor and Description |
---|
AbstractResource(String path,
URI uri) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
String |
getPath()
Returns the normalized, ResourceAccessor-relative path for this resource.
|
URI |
getUri()
Returns a unique and complete identifier for this resource.
|
int |
hashCode() |
boolean |
isWritable()
Return true if the resource can be written to
|
OutputStream |
openOutputStream(OpenOptions openOptions)
Opens an output stream given the passed
OpenOptions . |
protected String |
resolvePath(String other)
Convenience method for computing the relative path in
Resource.resolve(String) implementations |
protected String |
resolveSiblingPath(String other)
Convenience method for computing the relative path in
Resource.resolveSibling(String) implementations. |
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
exists, openInputStream, openOutputStream, resolve, resolveSibling
public String getPath()
Resource
Resource.getUri()
This should always use `/` for separators
This should not include any sort of protocol or prefixes
This should not have a leading /.
This should have any relative paths smoothed out -- return "path/to/resource" not "path/from/../to/resource".public URI getUri()
Resource
Resource.getPath()
because the path within the resource accessor whereas this is the a complete path to it.
For example, a file resource may return a path of my/file.txt
and a uri of file:/tmp/project/liquibase/my/file.txt
for a resource accessor using file:/tmp/project/liquibase
as a root
public boolean isWritable()
Resource
isWritable
in interface Resource
public OutputStream openOutputStream(OpenOptions openOptions) throws IOException
Resource
OpenOptions
.
Cannot pass a null OpenOptions valueopenOutputStream
in interface Resource
IOException
protected String resolvePath(String other)
Resource.resolve(String)
implementationsprotected String resolveSiblingPath(String other)
Resource.resolveSibling(String)
implementations.Copyright © 2023 Liquibase.org. All rights reserved.