1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 package org.apache.hc.core5.http.nio.entity;
28
29 import java.io.IOException;
30 import java.nio.ByteBuffer;
31 import java.util.List;
32
33 import org.apache.hc.core5.concurrent.FutureCallback;
34 import org.apache.hc.core5.http.EntityDetails;
35 import org.apache.hc.core5.http.Header;
36 import org.apache.hc.core5.http.HttpException;
37 import org.apache.hc.core5.http.nio.AsyncEntityConsumer;
38 import org.apache.hc.core5.http.nio.CapacityChannel;
39
40
41
42
43
44
45
46
47 @Deprecated
48 public final class NoopEntityConsumer implements AsyncEntityConsumer<Void> {
49
50 private volatile FutureCallback<Void> resultCallback;
51
52 @Override
53 public void streamStart(
54 final EntityDetails entityDetails,
55 final FutureCallback<Void> resultCallback) throws IOException, HttpException {
56 this.resultCallback = resultCallback;
57 }
58
59 @Override
60 public void updateCapacity(final CapacityChannel capacityChannel) throws IOException {
61 capacityChannel.update(Integer.MAX_VALUE);
62 }
63
64 @Override
65 public void consume(final ByteBuffer src) throws IOException {
66 }
67
68 @Override
69 public void streamEnd(final List<? extends Header> trailers) throws IOException {
70 if (resultCallback != null) {
71 resultCallback.completed(null);
72 }
73 }
74
75 @Override
76 public void failed(final Exception cause) {
77 if (resultCallback != null) {
78 resultCallback.failed(cause);
79 }
80 }
81
82 @Override
83 public Void getContent() {
84 return null;
85 }
86
87 @Override
88 public void releaseResources() {
89 }
90
91 }