org.eclipse.jgit.lib
Class ObjectLoader

java.lang.Object
  extended by org.eclipse.jgit.lib.ObjectLoader
Direct Known Subclasses:
UnpackedObjectLoader

public abstract class ObjectLoader
extends java.lang.Object

Base class for a set of loaders for different representations of Git objects. New loaders are constructed for every object.


Constructor Summary
ObjectLoader()
           
 
Method Summary
 byte[] getBytes()
          Obtain a copy of the bytes of this object.
abstract  byte[] getCachedBytes()
          Obtain a reference to the (possibly cached) bytes of this object.
abstract  long getRawSize()
           
abstract  int getRawType()
           
abstract  long getSize()
           
abstract  int getType()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectLoader

public ObjectLoader()
Method Detail

getType

public abstract int getType()
Returns:
Git in pack object type, see Constants.

getSize

public abstract long getSize()
Returns:
size of object in bytes

getBytes

public final byte[] getBytes()
Obtain a copy of the bytes of this object.

Unlike getCachedBytes() this method returns an array that might be modified by the caller.

Returns:
the bytes of this object.

getCachedBytes

public abstract byte[] 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:
the cached bytes of this object. Do not modify it.

getRawType

public abstract int getRawType()
Returns:
raw object type from object header, as stored in storage (pack, loose file). This may be different from getType() result for packs (see Constants).

getRawSize

public abstract long getRawSize()
Returns:
raw size of object from object header (pack, loose file). Interpretation of this value depends on getRawType().