T
- The type of stream elementspublic interface CloseableStream<T> extends Stream<T>, AutoCloseable
CloseableStream
is a Stream
that can be closed.
The close method is invoked to release resources that the object is
holding (such as open files).Stream.Builder<T>
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this resource, relinquishing any underlying resources.
|
allMatch, anyMatch, builder, collect, collect, concat, count, distinct, empty, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEach, forEachOrdered, generate, iterate, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, of, of, peek, reduce, reduce, reduce, sorted, sorted, substream, substream, toArray, toArray
isParallel, iterator, parallel, sequential, spliterator, unordered
void close()
try
-with-resources statement. Does nothing if called when
the resource has already been closed.
This method does not allow throwing checked Exception
s like
AutoCloseable.close()
. Cases where the
close operation may fail require careful attention by implementers. It
is strongly advised to relinquish the underlying resources and to
internally mark the resource as closed. The close
method is unlikely to be invoked more than once and so this ensures
that the resources are released in a timely manner. Furthermore it
reduces problems that could arise when the resource wraps, or is
wrapped, by another resource.close
in interface AutoCloseable
AutoCloseable.close()
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2013, Oracle and/or its affiliates. All rights reserved.
DRAFT internal-0