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;
28 import org.apache.solr.common.util.ContentStream;
35 class AbstractFileStringContentStream
implements ContentStream {
38 private final AbstractFile content;
39 private final Charset charset;
41 private final InputStream stream;
43 public AbstractFileStringContentStream(AbstractFile content, Charset charset, InputStream inputStream) {
44 this.content = content;
45 this.charset = charset;
46 this.stream = inputStream;
49 public AbstractContent getSourceContent() {
54 public String getContentType() {
55 return "text/plain;charset=" + charset.name();
59 public String getName() {
60 return content.getName();
64 public Reader getReader() throws IOException {
65 return new InputStreamReader(stream);
70 public Long getSize() {
72 throw new UnsupportedOperationException(
73 NbBundle.getMessage(
this.getClass(),
"AbstractFileStringContentStream.getSize.exception.msg"));
77 public String getSourceInfo() {
78 return NbBundle.getMessage(this.getClass(),
"AbstractFileStringContentStream.getSrcInfo.text", content.getId());
82 public InputStream getStream() throws IOException {
87 protected void finalize() throws Throwable {