19 package org.sleuthkit.autopsy.keywordsearch;
21 import java.io.IOException;
22 import java.io.InputStream;
23 import java.io.InputStreamReader;
24 import java.io.Reader;
25 import java.nio.charset.Charset;
27 import org.openide.util.NbBundle;
29 import org.apache.solr.common.util.ContentStream;
36 class AbstractFileStringContentStream
implements ContentStream {
39 private AbstractFile content;
40 private Charset charset;
42 private InputStream stream;
43 private static Logger logger = Logger.getLogger(AbstractFileStringContentStream.class.getName());
45 public AbstractFileStringContentStream(AbstractFile content, Charset charset, InputStream inputStream) {
46 this.content = content;
47 this.charset = charset;
48 this.stream = inputStream;
51 public AbstractContent getSourceContent() {
56 public String getContentType() {
57 return "text/plain;charset=" + charset.name();
61 public String getName() {
66 public Reader getReader() throws IOException {
67 return new InputStreamReader(stream);
72 public Long getSize() {
74 throw new UnsupportedOperationException(
75 NbBundle.getMessage(
this.getClass(),
"AbstractFileStringContentStream.getSize.exception.msg"));
79 public String getSourceInfo() {
80 return NbBundle.getMessage(this.getClass(),
"AbstractFileStringContentStream.getSrcInfo.text", content.getId());
84 public InputStream getStream() throws IOException {
89 protected void finalize() throws Throwable {