Autopsy  3.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
AbstractFileChunk.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2012 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 package org.sleuthkit.autopsy.keywordsearch;
21 
22 import java.nio.charset.Charset;
23 
24 import org.openide.util.NbBundle;
26 
30 class AbstractFileChunk {
31  private int chunkID;
32  private TextExtractor parent;
33 
34  AbstractFileChunk(TextExtractor parent, int chunkID) {
35  this.parent = parent;
36  this.chunkID = chunkID;
37  }
38 
39  public TextExtractor getParent() {
40  return parent;
41  }
42 
43  public int getChunkId() {
44  return chunkID;
45  }
46 
52  public String getIdString() {
53  return Server.getChunkIdString(this.parent.getSourceFile().getId(), this.chunkID);
54  }
55 
56  public boolean index(Ingester ingester, byte[] content, long contentSize, Charset indexCharset) throws IngesterException {
57  boolean success = true;
58  ByteContentStream bcs = new ByteContentStream(content, contentSize, parent.getSourceFile(), indexCharset);
59  try {
60  ingester.ingest(this, bcs, content.length);
61  //logger.log(Level.INFO, "Ingesting string chunk: " + this.getName() + ": " + chunkID);
62  } catch (Exception ingEx) {
63  success = false;
64  throw new IngesterException(NbBundle.getMessage(this.getClass(), "AbstractFileChunk.index.exception.msg",
65  parent.getSourceFile().getId(), chunkID), ingEx);
66  }
67  return success;
68  }
69 
70 }
static String getChunkIdString(long parentID, int childID)
Definition: Server.java:906

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.