com.abubusoft.kripton.retrofit2.KriptonResponseBodyConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kripton-retrofit-converter Show documentation
Show all versions of kripton-retrofit-converter Show documentation
Kripton adapter for Retrofit library
package com.abubusoft.kripton.retrofit2;
import java.io.IOException;
import com.abubusoft.kripton.BinderContext;
import okhttp3.ResponseBody;
import retrofit2.Converter;
final class KriptonResponseBodyConverter implements Converter {
private BinderContext binderContext;
private Class clazz;
KriptonResponseBodyConverter(BinderContext binderContext, Class clazz) {
this.binderContext = binderContext;
this.clazz = clazz;
}
@Override
public T convert(ResponseBody value) throws IOException {
try {
return binderContext.parse(value.byteStream(), clazz);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
value.close();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy