@Test public void simpleStreamTest() { MockWebServer server = new MockWebServer(); server.enqueue(new MockResponse().setBody("foo\nbar")); StreamInterface api = Feign.builder() .decoder(StreamDecoder.create( (response, type) -> new BufferedReader(response.body().asReader(UTF_8)).lines() .iterator())) .doNotCloseAfterDecode() .target(StreamInterface.class, server.url("/").toString()); try (Stream<String> stream = api.get()) { assertThat(stream.collect(Collectors.toList())).isEqualTo(Arrays.asList("foo", "bar")); } }
public static StreamDecoder create(Decoder iteratorDecoder) { return new StreamDecoder(iteratorDecoder); }
StreamDecoder implements Decoder { public static StreamDecoder create(Decoder iteratorDecoder) { return new StreamDecoder(iteratorDecoder); } }
StreamDecoder implements Decoder { public static StreamDecoder create(Decoder iteratorDecoder) { return new StreamDecoder(iteratorDecoder); } StreamDecoder(Decoder iteratorDecoder); }
StreamDecoder implements Decoder { public static StreamDecoder create(Decoder iteratorDecoder) { return new StreamDecoder(iteratorDecoder); } StreamDecoder(Decoder iteratorDecoder); @Override Object decode(Response response, Type type); static StreamDecoder create(Decoder iteratorDecoder); }
StreamDecoder implements Decoder { public static StreamDecoder create(Decoder iteratorDecoder) { return new StreamDecoder(iteratorDecoder); } StreamDecoder(Decoder iteratorDecoder); @Override Object decode(Response response, Type type); static StreamDecoder create(Decoder iteratorDecoder);  }