Top Description Fields Constructors Methods
org.eclipse.jgit.lfs

public Class LfsBlobLoader

extends ObjectLoader
Class Inheritance
Imports
java.io.IOException, java.nio.file.Files, .Path, java.nio.file.attribute.BasicFileAttributes, org.eclipse.jgit.errors.LargeObjectException, .MissingObjectException, org.eclipse.jgit.lib.Constants, .ObjectLoader, .ObjectStream, org.eclipse.jgit.storage.pack.PackConfig, org.eclipse.jgit.util.IO

An ObjectLoader implementation that reads a media file from the LFS storage.
Since
4.11

Field Summary

Modifier and TypeField and Description
private BasicFileAttributes
private byte[]
private Path

Constructor Summary

AccessConstructor and Description
public
LfsBlobLoader(Path
path to the file
mediaFile
)

Create a loader for the LFS media file at the given path.

Method Summary

Modifier and TypeMethod and Description
public byte[]
getCachedBytes()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Obtain a reference to the (possibly cached) bytes of this object.

public long
getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

public int
getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

public ObjectStream
openStream()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Inherited from org.eclipse.jgit.lib.ObjectLoader:
copyTogetBytesgetBytesgetCachedBytesisLarge

Field Detail

attributesback to summary
private BasicFileAttributes attributes
cachedback to summary
private byte[] cached
mediaFileback to summary
private Path mediaFile

Constructor Detail

LfsBlobLoaderback to summary
public LfsBlobLoader(Path mediaFile) throws IOException

Create a loader for the LFS media file at the given path.

Parameters
mediaFile:Path

path to the file

Exceptions
IOException:
in case of an error reading attributes

Method Detail

getCachedBytesback to summary
public byte[] getCachedBytes() throws LargeObjectException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Doc from org.eclipse.jgit.lib.ObjectLoader.getCachedBytes.

Obtain a reference to the (possibly cached) bytes of this object.

This method offers direct access to the internal caches, potentially saving on data copies between the internal cache and higher level code. Callers who receive this reference must not modify its contents. Changes (if made) will affect the cache but not the repository itself.

Returns:byte[]

the cached bytes of this object. Do not modify it.

Annotations
@Override
Exceptions
LargeObjectException:
if the object won't fit into a byte array, because isLarge() returns true. Callers should use openStream() instead to access the contents.
getSizeback to summary
public long getSize()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getSize.

Doc from org.eclipse.jgit.lib.ObjectLoader.getSize.

Get size of object in bytes

Returns:long

size of object in bytes

Annotations
@Override
getTypeback to summary
public int getType()

Implements abstract org.eclipse.jgit.lib.ObjectLoader.getType.

Doc from org.eclipse.jgit.lib.ObjectLoader.getType.

Get Git in pack object type

Returns:int

Git in pack object type, see org.eclipse.jgit.lib.Constants.

Annotations
@Override
openStreamback to summary
public ObjectStream openStream() throws MissingObjectException, IOException

Implements abstract org.eclipse.jgit.lib.ObjectLoader.openStream.

Doc from org.eclipse.jgit.lib.ObjectLoader.openStream.

Obtain an input stream to read this object's data.

Returns:ObjectStream

a stream of this object's data. Caller must close the stream when through with it. The returned stream is buffered with a reasonable buffer size.

Annotations
@Override
Exceptions
MissingObjectException:
the object no longer exists.
IOException:
the object store cannot be accessed.