java.lang.Object
io.helidon.http.media.multipart.MultiPart
- All Implemented Interfaces:
AutoCloseable,Iterator<ReadablePart>
Multi part message is an iterator of parts. The iterator can be traversed one time only,
as the data is read during processing (so we do not create parts in memory).
This type can be used with
ReadableEntity#as(Class).
The built-in multipart reader transfers ownership of its input stream to the returned message and closes
it when iteration completes. Use try-with-resources when processing can stop before the last part.
Closing the message closes its retained input stream without iterating the remaining parts itself.
The stream's close behavior still applies: closing a nested multipart message drains the enclosing part
through its boundary, which can read additional input, and leaves the outer message available for further iteration.
Transport-specific request or response cleanup still applies. Closing an individual part's input stream
likewise finishes only that part and leaves its message available for further iteration.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release resources owned by this multipart message.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next, remove
-
Field Details
-
GENERIC_TYPE
Generic type ofMultiPart.
-
-
Constructor Details
-
MultiPart
public MultiPart()This class is empty, this constructor does nothing.
-
-
Method Details
-
close
public void close()Release resources owned by this multipart message. The built-in reader's message closes its retained input stream without iterating the remaining parts itself. Closing a nested multipart message drains its enclosing part through the part boundary; this can read additional input and leaves the outer message available for further iteration. AfterwardsIterator.hasNext()returnsfalseandIterator.next()throwsNoSuchElementException. Repeated calls have no effect, including after a close failure. The default implementation does nothing to preserve compatibility with existing subclasses. Subclasses that own resources must override this method to release them and stop iteration.- Specified by:
closein interfaceAutoCloseable- Throws:
UncheckedIOException- if closing the built-in reader's input stream fails
-