org.eclipse.jgit.lib
Class UnpackedObjectLoader

java.lang.Object
  extended by org.eclipse.jgit.lib.ObjectLoader
      extended by org.eclipse.jgit.lib.UnpackedObjectLoader

public class UnpackedObjectLoader
extends ObjectLoader

Loose object loader. This class loads an object not stored in a pack.


Constructor Summary
UnpackedObjectLoader(byte[] compressed)
          Construct an ObjectLoader from a loose object's compressed form.
UnpackedObjectLoader(java.io.File path, AnyObjectId id)
          Construct an ObjectLoader to read from the file.
 
Method Summary
 byte[] getCachedBytes()
          Obtain a reference to the (possibly cached) bytes of this object.
 long getRawSize()
           
 int getRawType()
           
 long getSize()
           
 int getType()
           
 
Methods inherited from class org.eclipse.jgit.lib.ObjectLoader
getBytes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UnpackedObjectLoader

public UnpackedObjectLoader(java.io.File path,
                            AnyObjectId id)
                     throws java.io.IOException
Construct an ObjectLoader to read from the file.

Parameters:
path - location of the loose object to read.
id - expected identity of the object being loaded, if known.
Throws:
java.io.FileNotFoundException - the loose object file does not exist.
java.io.IOException - the loose object file exists, but is corrupt.

UnpackedObjectLoader

public UnpackedObjectLoader(byte[] compressed)
                     throws CorruptObjectException
Construct an ObjectLoader from a loose object's compressed form.

Parameters:
compressed - entire content of the loose object file.
Throws:
CorruptObjectException - The compressed data supplied does not match the format for a valid loose object.
Method Detail

getType

public int getType()
Specified by:
getType in class ObjectLoader
Returns:
Git in pack object type, see Constants.

getSize

public long getSize()
Specified by:
getSize in class ObjectLoader
Returns:
size of object in bytes

getCachedBytes

public byte[] getCachedBytes()
Description copied from class: ObjectLoader
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.

Specified by:
getCachedBytes in class ObjectLoader
Returns:
the cached bytes of this object. Do not modify it.

getRawType

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

getRawSize

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