com.abubusoft.kripton.retrofit2.KriptonBinderResponseBodyConverter 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 KriptonBinderResponseBodyConverter implements Converter {
private Class clazz;
private BinderContext binderContext;
KriptonBinderResponseBodyConverter(BinderContext binderContext, Class clazz) {
this.clazz = clazz;
this.binderContext = binderContext;
}
@Override
public T convert(ResponseBody value) throws IOException {
try {
return (T) binderContext.parse(value.byteStream(), clazz);
} catch (Exception e) {
e.printStackTrace();
return null;
} finally {
value.close();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy