Top Description Fields Constructors Methods
io.smallrye.common.resource

public final Class MappedDirectoryStream<T, R>

extends Object
implements DirectoryStream<R>
Class Inheritance
All Implemented Interfaces
java.nio.file.DirectoryStream, java.lang.Iterable, java.io.Closeable, java.lang.AutoCloseable
Type Parameters
<T>
the input entry type
<R>
the output entry type
Imports
java.io.IOException, java.nio.file.DirectoryStream, java.util.Iterator, java.util.function.Function, io.smallrye.common.constraint.Assert

A directory stream to map one kind of entry to another.

Field Summary

Modifier and TypeField and Description
private final DirectoryStream<T>
private final Function<T, R>

Constructor Summary

AccessConstructor and Description
public
MappedDirectoryStream(final DirectoryStream<T>
the delegate stream (must not be null)
delegate
,
final Function<T, R>
the mapping function (must not be null)
mappingFunction
)

Construct a new instance.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public Iterator<R>
iterator()

Implements java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final DirectoryStream<T> delegate
mappingFunctionback to summary
private final Function<T, R> mappingFunction

Constructor Detail

MappedDirectoryStreamback to summary
public MappedDirectoryStream(final DirectoryStream<T> delegate, final Function<T, R> mappingFunction)

Construct a new instance.

Parameters
delegate:DirectoryStream<T>

the delegate stream (must not be null)

mappingFunction:Function<T, R>

the mapping function (must not be null)

Method Detail

closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Exceptions
IOException:
if an I/O error occurs
iteratorback to summary
public Iterator<R> iterator()

Implements java.nio.file.DirectoryStream.iterator.

Doc from java.nio.file.DirectoryStream.iterator.

Returns the iterator associated with this DirectoryStream.

Returns:Iterator<R>

the iterator associated with this DirectoryStream