use of org.codelibs.fess.crawler.entity.AccessResultData in project fess-crawler by codelibs.
the class BinaryTransformer method transform.
/*
* (non-Javadoc)
*
* @see
* org.codelibs.fess.crawler.transformer.Transformer#getData(org.codelibs.fess.crawler.entity
* .AccessResultData)
*/
@Override
public ResultData transform(final ResponseData responseData) {
if (responseData == null || !responseData.hasResponseBody()) {
throw new CrawlingAccessException("No response body.");
}
final ResultData resultData = new ResultData();
resultData.setTransformerName(getName());
try (BufferedInputStream bis = new BufferedInputStream(responseData.getResponseBody())) {
resultData.setData(IOUtils.toByteArray(bis));
resultData.setEncoding(responseData.getCharSet());
return resultData;
} catch (final IOException e) {
throw new CrawlerSystemException("Could not convert the input stream.", e);
}
}
Aggregations