Package liquibase.resource
Class PathResource
- java.lang.Object
-
- liquibase.resource.AbstractResource
-
- liquibase.resource.PathResource
-
- All Implemented Interfaces:
Resource
public class PathResource extends AbstractResource
-
-
Constructor Summary
Constructors Constructor Description PathResource(String logicalPath, Path path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
exists()
boolean
isWritable()
Return true if the resource can be written toInputStream
openInputStream()
Opens an input stream to read from this resource.OutputStream
openOutputStream(OpenOptions openOptions)
Opens an output stream given the passedOpenOptions
.Resource
resolve(String other)
Resolve the given path against this resource.Resource
resolveSibling(String other)
Resolves the given path against this resource's parent path.-
Methods inherited from class liquibase.resource.AbstractResource
equals, getPath, getUri, hashCode, resolvePath, resolveSiblingPath, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface liquibase.resource.Resource
openOutputStream
-
-
-
-
Method Detail
-
openInputStream
public InputStream openInputStream() throws IOException
Description copied from interface:Resource
Opens an input stream to read from this resource.- Throws:
IOException
- if there is an error reading from the resource, including if the resource does not exist or cannot be read.
-
exists
public boolean exists()
- Returns:
- true if the resource defined by this object currently exists.
-
resolve
public Resource resolve(String other)
Description copied from interface:Resource
Resolve the given path against this resource. If other is an empty path then this method trivially returns this path. Otherwise this method considers this resource to be a directory and resolves the given path against this resource. Even if "other" begins with a `/`, the returned resource should be relative to this resource.
-
resolveSibling
public Resource resolveSibling(String other)
Description copied from interface:Resource
Resolves the given path against this resource's parent path. This is useful where a file name needs to be replaced with another file name. For example, suppose that the name separator is "/" and a path represents "dir1/dir2/foo", then invoking this method with the Path "bar" will result in the Path "dir1/dir2/bar". If other is an empty path then this method returns this path's parent. Even if "other" begins with a `/`, the returned resource should be relative to this resource.
-
isWritable
public boolean isWritable()
Description copied from interface:Resource
Return true if the resource can be written to- Specified by:
isWritable
in interfaceResource
- Overrides:
isWritable
in classAbstractResource
-
openOutputStream
public OutputStream openOutputStream(OpenOptions openOptions) throws IOException
Description copied from interface:Resource
Opens an output stream given the passedOpenOptions
. Cannot pass a null OpenOptions value- Specified by:
openOutputStream
in interfaceResource
- Overrides:
openOutputStream
in classAbstractResource
- Throws:
IOException
-
-