Example usage for com.squareup.okhttp ResponseBody charStream

List of usage examples for com.squareup.okhttp ResponseBody charStream

Introduction

In this page you can find the example usage for com.squareup.okhttp ResponseBody charStream.

Prototype

public final Reader charStream() throws IOException 

Source Link

Document

Returns the response as a character stream decoded with the charset of the Content-Type header.

Usage

From source file:retrofit2.JacksonResponseBodyConverter.java

License:Apache License

@Override
public T convert(ResponseBody value) throws IOException {
    Reader reader = value.charStream();
    try {// w  w w .  j  a va  2 s  . c om
        return adapter.readValue(reader);
    } finally {
        if (reader != null) {
            try {
                reader.close();
            } catch (IOException ignored) {
            }
        }
    }
}