Class ClassLoaderFileSystem
FileSystem implementation looking up resources using a ClassLoader.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classAutoServiceregistrar for theClassLoaderFileSystem.static classNested classes/interfaces inherited from class org.apache.beam.sdk.io.FileSystem
FileSystem.LineageLevel -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcopy(List<ClassLoaderFileSystem.ClassLoaderResourceId> srcResourceIds, List<ClassLoaderFileSystem.ClassLoaderResourceId> destResourceIds) Copies aListof file-like resources from one location to another.protected WritableByteChannelcreate(ClassLoaderFileSystem.ClassLoaderResourceId resourceId, CreateOptions createOptions) Returns a write channel for the givenFileSystem.protected voiddelete(Collection<ClassLoaderFileSystem.ClassLoaderResourceId> resourceIds) Deletes a collection of resources.protected StringGet the URI scheme which defines the namespace of theFileSystem.protected List<MatchResult> This is the entry point to convert user-provided specs toResourceIds.matchNewResource(String path, boolean isDirectory) Returns a newResourceIdfor this filesystem that represents the named resource.protected ReadableByteChannelopen(ClassLoaderFileSystem.ClassLoaderResourceId resourceId) Returns a read channel for the givenFileSystem.protected voidrename(List<ClassLoaderFileSystem.ClassLoaderResourceId> srcResourceIds, List<ClassLoaderFileSystem.ClassLoaderResourceId> destResourceIds, MoveOptions... moveOptions) Renames aListof file-like resources from one location to another.Methods inherited from class org.apache.beam.sdk.io.FileSystem
reportLineage, reportLineage
-
Field Details
-
SCHEMA
- See Also:
-
-
Method Details
-
match
Description copied from class:FileSystemThis is the entry point to convert user-provided specs toResourceIds. Callers should useFileSystem.match(java.util.List<java.lang.String>)to resolve users specs ambiguities before calling other methods.Implementation should handle the following ambiguities of a user-provided spec:
speccould be a glob or a uri.FileSystem.match(java.util.List<java.lang.String>)should be able to tell and choose efficient implementations.- The user-provided
specmight refer to files or directories. It is common that users that wish to indicate a directory will omit the trailing/, such as in a spec of"/tmp/dir". TheFileSystemshould be able to recognize a directory with the trailing/omitted, but should always return a correctFileSystem(e.g.,"/tmp/dir/"inside the returnedMatchResult.
All
FileSystemimplementations should support glob in the final hierarchical path component ofFileSystem. This allows SDK libraries to construct file system agnostic spec.FileSystemscan support additional patterns for user-provided specs.- Specified by:
matchin classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Returns:
List<MatchResult>in the same order of the input specs.- Throws:
IOException- if all specs failed to match due to issues like: network connection, authorization. Exception for individual spec need to be deferred until callers retrieve metadata withMatchResult.metadata().
-
create
protected WritableByteChannel create(ClassLoaderFileSystem.ClassLoaderResourceId resourceId, CreateOptions createOptions) throws IOException Description copied from class:FileSystemReturns a write channel for the givenFileSystem.The resource is not expanded; it is used verbatim.
- Specified by:
createin classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Parameters:
resourceId- the reference of the file-like resource to createcreateOptions- the configuration of the create operation- Throws:
IOException
-
open
protected ReadableByteChannel open(ClassLoaderFileSystem.ClassLoaderResourceId resourceId) throws IOException Description copied from class:FileSystemReturns a read channel for the givenFileSystem.The resource is not expanded; it is used verbatim.
If seeking is supported, then this returns a
SeekableByteChannel.- Specified by:
openin classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Parameters:
resourceId- the reference of the file-like resource to open- Throws:
IOException
-
copy
protected void copy(List<ClassLoaderFileSystem.ClassLoaderResourceId> srcResourceIds, List<ClassLoaderFileSystem.ClassLoaderResourceId> destResourceIds) throws IOException Description copied from class:FileSystemCopies aListof file-like resources from one location to another.The number of source resources must equal the number of destination resources. Destination resources will be created recursively.
- Specified by:
copyin classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Parameters:
srcResourceIds- the references of the source resourcesdestResourceIds- the references of the destination resources- Throws:
IOException
-
rename
protected void rename(List<ClassLoaderFileSystem.ClassLoaderResourceId> srcResourceIds, List<ClassLoaderFileSystem.ClassLoaderResourceId> destResourceIds, MoveOptions... moveOptions) throws IOException Description copied from class:FileSystemRenames aListof file-like resources from one location to another.The number of source resources must equal the number of destination resources. Destination resources will be created recursively.
- Specified by:
renamein classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Parameters:
srcResourceIds- the references of the source resourcesdestResourceIds- the references of the destination resourcesmoveOptions- move options specifying handling of error conditions- Throws:
IOException
-
delete
protected void delete(Collection<ClassLoaderFileSystem.ClassLoaderResourceId> resourceIds) throws IOException Description copied from class:FileSystemDeletes a collection of resources.- Specified by:
deletein classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- Parameters:
resourceIds- the references of the resources to delete.- Throws:
IOException
-
matchNewResource
protected ClassLoaderFileSystem.ClassLoaderResourceId matchNewResource(String path, boolean isDirectory) Description copied from class:FileSystemReturns a newResourceIdfor this filesystem that represents the named resource. The user supplies both the resource spec and whether it is a directory.The supplied
singleResourceSpecis expected to be in a proper format, including any necessary escaping, for thisFileSystem.This function may throw an
IllegalArgumentExceptionif given an invalid argument, such as when the specifiedsingleResourceSpecis not a valid resource name.- Specified by:
matchNewResourcein classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>
-
getScheme
Description copied from class:FileSystemGet the URI scheme which defines the namespace of theFileSystem.- Specified by:
getSchemein classFileSystem<ClassLoaderFileSystem.ClassLoaderResourceId>- See Also:
-