Example usage for org.apache.solr.common.util ContentStreamBase getStream

List of usage examples for org.apache.solr.common.util ContentStreamBase getStream

Introduction

In this page you can find the example usage for org.apache.solr.common.util ContentStreamBase getStream.

Prototype

InputStream getStream() throws IOException;

Source Link

Document

Get an open stream.

Usage

From source file:alba.components.FilteredShowFileRequestHandler.java

License:Apache License

private StringBuilder getTemplate(ContentStreamBase content) {
    InputStream stream = null;//from w  w w .  ja v a  2  s  .co  m

    StringBuilder sb = new StringBuilder();

    BufferedReader br;

    String line = "";

    try {
        stream = content.getStream();

        br = new BufferedReader(new InputStreamReader(stream));
        while ((line = br.readLine()) != null) {
            if (line.matches(".*src=\"\\/.*")) {
                //TODO solr/dbpedia OFCOURSE must be parametric / automatic (better!) 
                line = line.replaceAll("src=\"", "src=\"/solr/dbpedia_shard1_replica1/admin/file?file=");
            }
            sb.append(line);

        }

    } catch (IOException e) {
        // TODO Auto-generated catch block
        logger.error("error on filtering ", e);
    } finally {
        IOUtils.closeQuietly(stream);
    }

    return sb;
}