19 package org.sleuthkit.autopsy.keywordsearch;
 
   21 import java.io.ByteArrayInputStream;
 
   22 import java.io.IOException;
 
   23 import java.io.InputStream;
 
   24 import java.io.InputStreamReader;
 
   25 import java.io.Reader;
 
   26 import java.nio.charset.Charset;
 
   28 import org.openide.util.NbBundle;
 
   30 import org.apache.solr.common.util.ContentStream;
 
   37 class ByteContentStream 
implements ContentStream {
 
   40     private byte[] content; 
 
   41     private long contentSize;
 
   42     private AbstractContent aContent; 
 
   43     private Charset charset; 
 
   45     private InputStream stream;
 
   47     private static Logger logger = Logger.getLogger(ByteContentStream.class.getName());
 
   49     public ByteContentStream(byte[] content, 
long contentSize, AbstractContent aContent, Charset charset) {
 
   50         this.content = content;
 
   51         this.aContent = aContent;
 
   52         this.charset = charset;
 
   53         stream = 
new ByteArrayInputStream(content, 0, (
int) contentSize);
 
   56     public byte[] getByteContent() {
 
   60     public AbstractContent getSourceContent() {
 
   65     public String getContentType() {
 
   66         return "text/plain;charset=" + charset.name(); 
 
   70     public String getName() {
 
   71         return aContent.getName();
 
   75     public Reader getReader() throws IOException {
 
   76         return new InputStreamReader(stream);
 
   81     public Long getSize() {
 
   86     public String getSourceInfo() {
 
   87         return NbBundle.getMessage(this.getClass(), 
"ByteContentStream.getSrcInfo.text", aContent.getId());
 
   91     public InputStream getStream() throws IOException {
 
   96     protected void finalize() throws Throwable {