Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
IngestJobInputStream.java
Go to the documentation of this file.
1/*
2 * Autopsy Forensic Browser
3 *
4 * Copyright 2020 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 */
19package org.sleuthkit.autopsy.ingest;
20
21import java.util.List;
22
27class IngestJobInputStream implements IngestStream {
28
29 private final IngestJob ingestJob;
30 private boolean closed = false;
31 private boolean isStopped = false;
32 private final IngestJobStartResult ingestJobStartResult;
33
40 IngestJobInputStream(IngestJob ingestJob) {
41 this.ingestJob = ingestJob;
42 ingestJobStartResult = IngestManager.getInstance().startIngestJob(ingestJob);
43 }
44
50 IngestJobStartResult getIngestJobStartResult() {
51 return ingestJobStartResult;
52 }
53
54 @Override
55 public synchronized void addFiles(List<Long> fileObjectIds) throws IngestStreamClosedException {
56 if (closed) {
57 throw new IngestStreamClosedException("Can not add files - ingest stream is closed");
58 }
59 ingestJob.addStreamedFiles(fileObjectIds);
60 }
61
62 @Override
63 public IngestJob getIngestJob() {
64 return ingestJob;
65 }
66
67 @Override
68 public synchronized void close() {
69 closed = true;
70 ingestJob.addStreamedDataSource();
71 }
72
73 @Override
74 public synchronized boolean isClosed() {
75 return closed;
76 }
77
78 @Override
79 public synchronized void stop() {
80 this.closed = true;
81 this.isStopped = true;
82
83 ingestJob.cancel(IngestJob.CancellationReason.USER_CANCELLED);
84 }
85
86 @Override
87 public synchronized boolean wasStopped() {
88 return isStopped;
89 }
90}

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.