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(boolean createIfNeeded)
Opens an output stream to write to this resource.
|
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, waitexists, openInputStream, resolve, resolveSiblingpublic String getPath()
ResourceResource.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()
ResourceResource.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()
ResourceisWritable in interface Resourcepublic OutputStream openOutputStream(boolean createIfNeeded) throws IOException
ResourceopenOutputStream in interface ResourcecreateIfNeeded - if true, create the resource if it does not exist. If false, throw an exception if it does not existIOException - if there is an error writing to the resource, including if the resource does not exist or permission don't allow writing.protected String resolvePath(String other)
Resource.resolve(String) implementationsprotected String resolveSiblingPath(String other)
Resource.resolveSibling(String) implementations.Copyright © 2022 Liquibase.org. All rights reserved.