Package org.eclipse.jgit.lfs
Class LfsBlobLoader
- java.lang.Object
-
- org.eclipse.jgit.lib.ObjectLoader
-
- org.eclipse.jgit.lfs.LfsBlobLoader
-
public class LfsBlobLoader extends ObjectLoader
AnObjectLoaderimplementation that reads a media file from the LFS storage.- Since:
- 4.11
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jgit.lib.ObjectLoader
ObjectLoader.Filter, ObjectLoader.SmallObject
-
-
Constructor Summary
Constructors Constructor Description LfsBlobLoader(Path mediaFile)Create a loader for the LFS media file at the given path.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getCachedBytes()Obtain a reference to the (possibly cached) bytes of this object.longgetSize()Get size of object in bytesintgetType()Get Git in pack object typeObjectStreamopenStream()Obtain an input stream to read this object's data.-
Methods inherited from class org.eclipse.jgit.lib.ObjectLoader
copyTo, getBytes, getBytes, getCachedBytes, isLarge
-
-
-
-
Constructor Detail
-
LfsBlobLoader
public LfsBlobLoader(Path mediaFile) throws IOException
Create a loader for the LFS media file at the given path.- Parameters:
mediaFile- path to the file- Throws:
IOException- in case of an error reading attributes
-
-
Method Detail
-
getType
public int getType()
Description copied from class:ObjectLoaderGet Git in pack object type- Specified by:
getTypein classObjectLoader- Returns:
- Git in pack object type, see
Constants.
-
getSize
public long getSize()
Description copied from class:ObjectLoaderGet size of object in bytes- Specified by:
getSizein classObjectLoader- Returns:
- size of object in bytes
-
getCachedBytes
public byte[] getCachedBytes() throws LargeObjectExceptionDescription copied from class:ObjectLoaderObtain 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.
- Specified by:
getCachedBytesin classObjectLoader- Returns:
- the cached bytes of this object. Do not modify it.
- Throws:
LargeObjectException- if the object won't fit into a byte array, becauseObjectLoader.isLarge()returns true. Callers should useObjectLoader.openStream()instead to access the contents.
-
openStream
public ObjectStream openStream() throws MissingObjectException, IOException
Description copied from class:ObjectLoaderObtain an input stream to read this object's data.- Specified by:
openStreamin classObjectLoader- Returns:
- 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.
- Throws:
MissingObjectException- the object no longer exists.IOException- the object store cannot be accessed.
-
-