All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.abubusoft.kripton.retrofit2.KriptonBinderResponseBodyConverter Maven / Gradle / Ivy

There is a newer version: 8.2.0-rc.4
Show newest version
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