Top Methods
liquibase.resource

public Interface Resource

Known Direct Implementers
liquibase.resource.AbstractResource
Imports
java.io.IOException, .InputStream, .OutputStream, java.net.URI

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the resource defined by this object currently exists.
exists
()

public String
getPath()

Returns the normalized, ResourceAccessor-relative path for this resource.

public URI
getUri()

Returns a unique and complete identifier for this resource.

public boolean
isWritable()

Return true if the resource can be written to

public InputStream
openInputStream()

Opens an input stream to read from this resource.

public OutputStream
openOutputStream(OpenOptions openOptions)

Opens an output stream given the passed OpenOptions.

public default OutputStream
openOutputStream(boolean createIfNeeded)

Opens an output stream to write to this resource using the default OpenOptions#OpenOptions() settings plus the passed createIfNeeded value.

public Resource
resolve(String other)

Resolve the given path against this resource.

public Resource
resolveSibling(String other)

Resolves the given path against this resource's parent path.

Method Detail

existsback to summary
public boolean exists()
Returns:boolean

true if the resource defined by this object currently exists.

getPathback to summary
public String getPath()

Returns the normalized, ResourceAccessor-relative path for this resource. To get the unique location of this resource, use 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".

getUriback to summary
public URI getUri()

Returns a unique and complete identifier for this resource. This will be different than what is returned by 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

isWritableback to summary
public boolean isWritable()

Return true if the resource can be written to

openInputStreamback to summary
public InputStream openInputStream() throws IOException

Opens an input stream to read from this resource.

Exceptions
IOException:
if there is an error reading from the resource, including if the resource does not exist or cannot be read.
openOutputStreamback to summary
public OutputStream openOutputStream(OpenOptions openOptions) throws IOException

Opens an output stream given the passed OpenOptions. Cannot pass a null OpenOptions value

openOutputStreamback to summary
public default OutputStream openOutputStream(boolean createIfNeeded) throws IOException

Opens an output stream to write to this resource using the default OpenOptions#OpenOptions() settings plus the passed createIfNeeded value.

Annotations
@Deprecated
resolveback to summary
public Resource resolve(String other)

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.

resolveSiblingback to summary
public Resource resolveSibling(String other)

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.