File tree Expand file tree Collapse file tree 4 files changed +34
-0
lines changed
httpclient/src/main/java/feign/httpclient
okhttp/src/main/java/feign/okhttp Expand file tree Collapse file tree 4 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -218,6 +218,9 @@ public interface Body extends Closeable {
218218
219219 /** It is the responsibility of the caller to close the stream. */
220220 Reader asReader () throws IOException ;
221+
222+ /** */
223+ Reader asReader (Charset charset ) throws IOException ;
221224 }
222225
223226 private static final class InputStreamBody implements Response .Body {
@@ -257,6 +260,12 @@ public Reader asReader() throws IOException {
257260 return new InputStreamReader (inputStream , UTF_8 );
258261 }
259262
263+ @ Override
264+ public Reader asReader (Charset charset ) throws IOException {
265+ checkNotNull (charset , "charset should not be null" );
266+ return new InputStreamReader (inputStream , charset );
267+ }
268+
260269 @ Override
261270 public void close () throws IOException {
262271 inputStream .close ();
@@ -306,6 +315,12 @@ public Reader asReader() throws IOException {
306315 return new InputStreamReader (asInputStream (), UTF_8 );
307316 }
308317
318+ @ Override
319+ public Reader asReader (Charset charset ) throws IOException {
320+ checkNotNull (charset , "charset should not be null" );
321+ return new InputStreamReader (asInputStream (), charset );
322+ }
323+
309324 @ Override
310325 public void close () throws IOException {}
311326
Original file line number Diff line number Diff line change 2828import java .lang .reflect .InvocationHandler ;
2929import java .lang .reflect .Method ;
3030import java .lang .reflect .Type ;
31+ import java .nio .charset .Charset ;
3132import java .util .Arrays ;
3233import java .util .Collections ;
3334import java .util .HashMap ;
@@ -402,6 +403,11 @@ public Reader asReader() throws IOException {
402403 return original .body ().asReader ();
403404 }
404405
406+ @ Override
407+ public Reader asReader (Charset charset ) throws IOException {
408+ return original .body ().asReader (charset );
409+ }
410+
405411 @ Override
406412 public void close () throws IOException {
407413 closed .set (true );
Original file line number Diff line number Diff line change 2727import java .net .MalformedURLException ;
2828import java .net .URI ;
2929import java .net .URISyntaxException ;
30+ import java .nio .charset .Charset ;
3031import java .util .ArrayList ;
3132import java .util .Collection ;
3233import java .util .HashMap ;
@@ -226,6 +227,12 @@ public Reader asReader() throws IOException {
226227 return new InputStreamReader (asInputStream (), UTF_8 );
227228 }
228229
230+ @ Override
231+ public Reader asReader (Charset charset ) throws IOException {
232+ Util .checkNotNull (charset , "charset should not be null" );
233+ return new InputStreamReader (asInputStream (), charset );
234+ }
235+
229236 @ Override
230237 public void close () throws IOException {
231238 EntityUtils .consume (entity );
Original file line number Diff line number Diff line change 1717import java .io .IOException ;
1818import java .io .InputStream ;
1919import java .io .Reader ;
20+ import java .nio .charset .Charset ;
2021import java .util .Collection ;
2122import java .util .Map ;
2223import java .util .concurrent .TimeUnit ;
@@ -143,6 +144,11 @@ public InputStream asInputStream() throws IOException {
143144 public Reader asReader () throws IOException {
144145 return input .charStream ();
145146 }
147+
148+ @ Override
149+ public Reader asReader (Charset charset ) throws IOException {
150+ return asReader ();
151+ }
146152 };
147153 }
148154
You can’t perform that action at this time.
0 commit comments