jadex.webservice.examples.rs.chart.ChartResultMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-webservice Show documentation
Show all versions of jadex-applications-webservice Show documentation
The Jadex web service applications package contains several example applications, benchmarks and testcases using web service integration.
package jadex.webservice.examples.rs.chart;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import jadex.extension.rs.invoke.RestResponse;
import jadex.extension.rs.publish.mapper.IValueMapper;
/**
*
*/
public class ChartResultMapper implements IValueMapper
{
/**
*
*/
public Object convertValue(Object value) throws Exception
{
// Image ret = null;
// Handle client response
RestResponse res = (RestResponse)value;
InputStream is = res.getEntityInputStream();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int b = 0;
while(b!=-1)
{
b = is.read();
bos.write(b);
// System.out.print((char)b);
}
byte[] data = bos.toByteArray();
// ret = Toolkit.getDefaultToolkit().createImage(data);
return data;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy