A CompletableFuture that is completed when a multipart/byteranges
has been parsed asynchronously from a Content..
Once the parsing of the multipart/byteranges content completes successfully,
objects of this class are completed with a MultiPartByteRanges.
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.Parser byteRanges = new MultiPartByteRanges.Parser(boundary);
// Parse the content.
byteRanges.parse(content)
// When complete, use the parts.
.thenAccept(parts -> ...);
Parts
| Modifier and Type | Class and Description |
|---|---|
| public static class | MultiPartByteRanges.
The multipart/byteranges specific content source. |
| public static class | MultiPartByteRanges.
A specialized |
| public static class | |
| public static class | MultiPartByteRanges.
A |
| public static class | MultiPartByteRanges.
An ordered list of |
| public static class | MultiPartByteRanges.
A specialized |
| Access | Constructor and Description |
|---|---|
| private |
| MultiPartByteRanges | back to summary |
|---|---|
| private MultiPartByteRanges() | |
The multipart/byteranges specific content source.
MultiPart.AbstractContentSource
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean |
| ContentSource | back to summary |
|---|---|
| public ContentSource(String boundary) | |
| addPart | back to summary |
|---|---|
| public boolean addPart(MultiPart. Overrides org. Doc from org. Adds, if possible, the given
This method returns | |
A specialized org.
whose content is sliced by a byte range.
| Modifier and Type | Field and Description |
|---|---|
| private long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected int | fillBufferFromInputStream(InputStream inputStream, byte[] buffer)
Overrides org.
|
| toRead | back to summary |
|---|---|
| private long toRead | |
| InputStreamContentSource | back to summary |
|---|---|
| public InputStreamContentSource(InputStream inputStream, ByteRange byteRange) throws IOException | |
| fillBufferFromInputStream | back to summary |
|---|---|
| protected int fillBufferFromInputStream(InputStream inputStream, byte[] buffer) throws IOException Overrides org.
| |
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final MultiPartByteRanges. | |
| private final MultiPart. | |
| private MultiPartByteRanges. |
| Modifier and Type | Method and Description |
|---|---|
| public String | |
| public CompletableFuture |
| listener | back to summary |
|---|---|
| private final MultiPartByteRanges. | |
| parser | back to summary |
|---|---|
| private final MultiPart. | |
| parts | back to summary |
|---|---|
| private MultiPartByteRanges. | |
| Parser | back to summary |
|---|---|
| public Parser(String boundary) | |
| getBoundary | back to summary |
|---|---|
public String getBoundary()
| |
| parse | back to summary |
|---|---|
| public CompletableFuture | |
| Modifier and Type | Field and Description |
|---|---|
| private Throwable | |
| private final AutoLock | |
| private final List | |
| private final List |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private boolean | |
| public void | onComplete()
Overrides default org. Callback method invoked when the whole multipart content has been parsed. |
| public void | onFailure(Throwable
the failure cause failure)Overrides default org. Callback method invoked when the parser cannot parse the multipart content. |
| public void | onPart(String
the part name name, String the part fileName fileName, HttpFields the part headers headers)Implements abstract org. Callback method invoked when a |
| public void | onPartContent(Content.
the part content chunk chunkOverrides default org. Callback method invoked when a part content |
| failure | back to summary |
|---|---|
| private Throwable failure | |
| lock | back to summary |
|---|---|
| private final AutoLock lock | |
| partChunks | back to summary |
|---|---|
| private final List<Content. | |
| parts | back to summary |
|---|---|
| private final List<MultiPart. | |
| PartsListener | back to summary |
|---|---|
| private PartsListener() | |
| fail | back to summary |
|---|---|
| private void fail(Throwable cause) | |
| isFailed | back to summary |
|---|---|
| private boolean isFailed() | |
| onComplete | back to summary |
|---|---|
| public void onComplete() Overrides default org. Doc from org. Callback method invoked when the whole multipart content has been parsed.
| |
| onFailure | back to summary |
|---|---|
| public void onFailure(Throwable failure) Overrides default org. Doc from org. Callback method invoked when the parser cannot parse the multipart content. | |
| onPart | back to summary |
|---|---|
| public void onPart(String name, String fileName, HttpFields headers) Implements abstract org. Doc from org. Callback method invoked when a
| |
| onPartContent | back to summary |
|---|---|
| public void onPartContent(Content. Overrides default org. Doc from org. Callback method invoked when a part content The | |
A MultiPart. whose content is a byte range of a Resource.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteRange | |
| private final Resource |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Content. | newContentSource()
Implements abstract org. Returns the content of this part as a new If the content is reproducible, invoking this method multiple times will return a different independent instance for every invocation. |
| byteRange | back to summary |
|---|---|
| private final ByteRange byteRange | |
| resource | back to summary |
|---|---|
| private final Resource resource | |
| Part | back to summary |
|---|---|
| public Part(String contentType, Resource resource, ByteRange byteRange, long contentLength) | |
| Part | back to summary |
|---|---|
| public Part(HttpFields headers, Resource resource, ByteRange byteRange) | |
| newContentSource | back to summary |
|---|---|
| public Content. Implements abstract org. Doc from org. Returns the content of this part as a new If the content is reproducible, invoking this method multiple times will return a different independent instance for every invocation. If the content is not reproducible, subsequent calls to this method will return null. The content type and content encoding are specified in this part's The content encoding may be specified by the part named
| |
An ordered list of MultiPart.s that can
be accessed by index, or iterated over.
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final List |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public MultiPart. | Returns: theMultiPart.Part at the given indexthe index of the index)MultiPart.Part to returnReturns the |
| public String | |
| public Iterator | |
| public int |
| boundary | back to summary |
|---|---|
| private final String boundary | |
| parts | back to summary |
|---|---|
| private final List<MultiPart. | |
| Parts | back to summary |
|---|---|
| private Parts(String boundary, List<MultiPart. | |
| get | back to summary |
|---|---|
| public MultiPart. Returns the | |
| getBoundary | back to summary |
|---|---|
public String getBoundary()
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over elements of type | |
| size | back to summary |
|---|---|
public int size()
| |
A specialized org.
whose content is sliced by a byte range.
| Modifier and Type | Field and Description |
|---|---|
| private final ByteRange | |
| private long |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | |
| protected SeekableByteChannel | |
| protected int | read(SeekableByteChannel channel, ByteBuffer byteBuffer)
Overrides org.
|
| byteRange | back to summary |
|---|---|
| private final ByteRange byteRange | |
| toRead | back to summary |
|---|---|
| private long toRead | |
| PathContentSource | back to summary |
|---|---|
| public PathContentSource(Path path, ByteRange byteRange) | |
| isReadComplete | back to summary |
|---|---|
| protected boolean isReadComplete(long read) Overrides org.
| |
| open | back to summary |
|---|---|
| protected SeekableByteChannel open() throws IOException Overrides org.
| |
| read | back to summary |
|---|---|
| protected int read(SeekableByteChannel channel, ByteBuffer byteBuffer) throws IOException Overrides org.
| |