public abstract class ContentSource extends Object
DiffFormatter
.
A content source is not thread-safe. Sources may contain state, including information about the last ObjectLoader they returned. Callers must be careful to ensure there is no more than one ObjectLoader pending on any source, at any time.
Modifier and Type | Class and Description |
---|---|
static class |
ContentSource.Pair
A pair of sources to access the old and new sides of a DiffEntry.
|
Constructor and Description |
---|
ContentSource() |
Modifier and Type | Method and Description |
---|---|
static ContentSource |
create(ObjectReader reader)
Construct a content source for an ObjectReader.
|
static ContentSource |
create(WorkingTreeIterator iterator)
Construct a content source for a working directory.
|
abstract ObjectLoader |
open(String path,
ObjectId id)
Open the object.
|
abstract long |
size(String path,
ObjectId id)
Determine the size of the object.
|
public static ContentSource create(ObjectReader reader)
reader
- the reader to obtain blobs from.public static ContentSource create(WorkingTreeIterator iterator)
FileTreeIterator
an optimized version is used that doesn't require seeking through a
TreeWalk.iterator
- the iterator to obtain source files through.public abstract long size(String path, ObjectId id) throws IOException
path
- the path of the file, relative to the root of the repository.id
- blob id of the file, if known.IOException
- the file cannot be accessed.public abstract ObjectLoader open(String path, ObjectId id) throws IOException
path
- the path of the file, relative to the root of the repository.id
- blob id of the file, if known.IOException
- the file cannot be accessed.Copyright © 2019 Eclipse JGit Project. All rights reserved.