Instances of the liquibase.resource.Resource interface wrap implementation-specific read logic. It provides a standard interface for code to use regardless of whether the underlying file is local, remote, or anywhere else.
The base AbstractResource constructor takes a URI along with the path. Because the same path can match multiple Resources within a ResourceAccessor, the URI is the unique descriptor of this particular Resource.
resolve methods will need to look up other Resources, so passing the ResourceAccessor accessor into the constructor is often needed.
Returns the contents of the file as a stream.
Returns whether the resource exists or not. The resolve methods return relative Resources, without worrying about whether they are existing files or not. This method is used to check the existence of the resources.
resolve / resolveSibling
These methods return objects corresponding to other resources located relative to this resource.
Resolve is for finding a path within this resource's location (like a file in a directory),
resolveSibling is for finding a path next to this resource's location (like a file in the same directory).
The complete javadocs for
liquibase.resource.Resource is available at https://javadocs.liquibase.com
The following guides provide relevant examples: