Package feign.stream
Class StreamDecoder
- java.lang.Object
-
- feign.stream.StreamDecoder
-
- All Implemented Interfaces:
Decoder
public final class StreamDecoder extends java.lang.Object implements Decoder
Iterator based decoder that support streaming.Example:
Feign.builder() .decoder(StreamDecoder.create(JacksonIteratorDecoder.create())) .doNotCloseAfterDecode() // Required for streaming .target(GitHub.class, "https://api.github.com"); interface GitHub { @RequestLine("GET /repos/{owner}/{repo}/contributors") Stream
contributors(@Param("owner") String owner, @Param("repo") String repo); }
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface feign.codec.Decoder
Decoder.Default
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StreamDecoder
create(Decoder iteratorDecoder)
java.lang.Object
decode(Response response, java.lang.reflect.Type type)
Decodes an http response into an object corresponding to itsgeneric return type
.
-
-
-
Method Detail
-
decode
public java.lang.Object decode(Response response, java.lang.reflect.Type type) throws java.io.IOException, FeignException
Description copied from interface:Decoder
Decodes an http response into an object corresponding to itsgeneric return type
. If you need to wrap exceptions, please do so viaDecodeException
.- Specified by:
decode
in interfaceDecoder
- Parameters:
response
- the response to decodetype
-generic return type
of the method corresponding to thisresponse
.- Returns:
- instance of
type
- Throws:
java.io.IOException
- will be propagated safely to the caller.DecodeException
- when decoding failed due to a checked exception besides IOException.FeignException
- when decoding succeeds, but conveys the operation failed.
-
create
public static StreamDecoder create(Decoder iteratorDecoder)
-
-