Class MultiPartByteRanges

All Implemented Interfaces:
CompletionStage<MultiPartByteRanges.Parts>, Future<MultiPartByteRanges.Parts>

public class MultiPartByteRanges extends CompletableFuture<MultiPartByteRanges.Parts>

A CompletableFuture that is completed when a multipart/byteranges content has been parsed asynchronously from a Content.Source via parse(Content.Source).

Once the parsing of the multipart/byteranges content completes successfully, objects of this class are completed with a MultiPartByteRanges.Parts object.

Typical usage:


 // Some headers that include Content-Type.
 HttpFields headers = ...;
 String boundary = MultiPart.extractBoundary(headers.get(HttpHeader.CONTENT_TYPE));

 // Some multipart/byteranges content.
 Content.Source content = ...;

 // Create and configure MultiPartByteRanges.
 MultiPartByteRanges byteRanges = new MultiPartByteRanges(boundary);

 // Parse the content.
 byteRanges.parse(content)
     // When complete, use the parts.
     .thenAccept(parts -> ...);
 
See Also:
  • Constructor Details

    • MultiPartByteRanges

      public MultiPartByteRanges(String boundary)
  • Method Details

    • getBoundary

      public String getBoundary()
      Returns:
      the boundary string
    • completeExceptionally

      public boolean completeExceptionally(Throwable failure)
      Overrides:
      completeExceptionally in class CompletableFuture<MultiPartByteRanges.Parts>
    • parse

      public MultiPartByteRanges parse(org.eclipse.jetty.io.Content.Source content)

      Parses the given multipart/byteranges content.

      Returns this MultiPartByteRanges object, so that it can be used in the typical "fluent" style of CompletableFuture.

      Parameters:
      content - the multipart/byteranges content to parse
      Returns:
      this MultiPartByteRanges object