Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
830bf0e0
Commit
830bf0e0
authored
2 years ago
by
Greg DiCristofaro
Browse files
Options
Downloads
Patches
Plain Diff
return optional
parent
5066e978
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
+4
-8
4 additions, 8 deletions
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
bindings/java/src/org/sleuthkit/datamodel/ContentStream.java
+5
-3
5 additions, 3 deletions
bindings/java/src/org/sleuthkit/datamodel/ContentStream.java
with
9 additions
and
11 deletions
bindings/java/src/org/sleuthkit/datamodel/AbstractFile.java
+
4
−
8
View file @
830bf0e0
...
...
@@ -1080,7 +1080,7 @@ private boolean loadContentStream() throws TskCoreException {
return
true
;
}
else
if
(
tryContentStream
)
{
// only attempt to load if the flag indicates it should be tried
contentStream
=
getSleuthkitCase
().
getContentProvider
().
getContentStream
(
this
);
contentStream
=
getSleuthkitCase
().
getContentProvider
().
getContentStream
(
this
)
.
orElse
(
null
)
;
if
(
contentStream
==
null
)
{
// if no content stream could be loaded, mark tryContentStream as false so load
...
...
@@ -1106,15 +1106,11 @@ private boolean useContentProvider() {
@Override
public
final
int
read
(
byte
[]
buf
,
long
offset
,
long
len
)
throws
TskCoreException
{
//template method
//if localPath is set, use local, otherwise, use readCustom() supplied by derived class
if
(
useContentProvider
())
{
if
(
loadContentStream
())
{
return
this
.
contentStream
.
read
(
buf
,
offset
,
len
);
}
else
{
return
0
;
}
if
(
useContentProvider
()
&&
loadContentStream
())
{
return
this
.
contentStream
.
read
(
buf
,
offset
,
len
);
}
//if localPath is set, use local, otherwise, use readCustom() supplied by derived class
if
(
localPathSet
)
{
return
readLocal
(
buf
,
offset
,
len
);
}
else
{
...
...
This diff is collapsed.
Click to expand it.
bindings/java/src/org/sleuthkit/datamodel/ContentStream.java
+
5
−
3
View file @
830bf0e0
...
...
@@ -18,6 +18,8 @@
*/
package
org.sleuthkit.datamodel
;
import
java.util.Optional
;
/**
* Custom provider for content bytes.
*/
...
...
@@ -44,14 +46,14 @@ public interface ContentStream {
public
interface
ContentProvider
{
/**
* Provides a content stream for a content object or
null
if this
* Provides a content stream for a content object or
empty
if this
* provider has none to provide.
*
* @param content The content.
*
* @return The content stream or
null
if no stream can be provided
* @return The content stream or
empty
if no stream can be provided
* for this content.
*/
ContentStream
getContentStream
(
Content
content
)
throws
TskCoreException
;
Optional
<
ContentStream
>
getContentStream
(
Content
content
)
throws
TskCoreException
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment