org.eclipse.jgit.lib
Class ObjectWriter

java.lang.Object
  extended by org.eclipse.jgit.lib.ObjectWriter

public class ObjectWriter
extends java.lang.Object

A class for writing loose objects.


Constructor Summary
ObjectWriter(Repository d)
          Construct an Object writer for the specified repository
 
Method Summary
 ObjectId computeBlobSha1(long len, java.io.InputStream is)
          Compute the SHA-1 of a blob without creating an object.
 ObjectId writeBlob(byte[] b)
          Write a blob with the specified data
 ObjectId writeBlob(java.io.File f)
          Write a blob with the data in the specified file
 ObjectId writeBlob(long len, java.io.InputStream is)
          Write a blob with data from a stream
 ObjectId writeCanonicalTree(byte[] b)
          Write a canonical tree to the object database.
 ObjectId writeCommit(Commit c)
          Write a Commit to the object database
 ObjectId writeTag(Tag c)
          Write an annotated Tag to the object database
 ObjectId writeTree(Tree t)
          Write a Tree to the object database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectWriter

public ObjectWriter(Repository d)
Construct an Object writer for the specified repository

Parameters:
d -
Method Detail

writeBlob

public ObjectId writeBlob(byte[] b)
                   throws java.io.IOException
Write a blob with the specified data

Parameters:
b - bytes of the blob
Returns:
SHA-1 of the blob
Throws:
java.io.IOException

writeBlob

public ObjectId writeBlob(java.io.File f)
                   throws java.io.IOException
Write a blob with the data in the specified file

Parameters:
f - a file containing blob data
Returns:
SHA-1 of the blob
Throws:
java.io.IOException

writeBlob

public ObjectId writeBlob(long len,
                          java.io.InputStream is)
                   throws java.io.IOException
Write a blob with data from a stream

Parameters:
len - number of bytes to consume from the stream
is - stream with blob data
Returns:
SHA-1 of the blob
Throws:
java.io.IOException

writeTree

public ObjectId writeTree(Tree t)
                   throws java.io.IOException
Write a Tree to the object database.

Parameters:
t - Tree
Returns:
SHA-1 of the tree
Throws:
java.io.IOException

writeCanonicalTree

public ObjectId writeCanonicalTree(byte[] b)
                            throws java.io.IOException
Write a canonical tree to the object database.

Parameters:
b - the canonical encoding of the tree object.
Returns:
SHA-1 of the tree
Throws:
java.io.IOException

writeCommit

public ObjectId writeCommit(Commit c)
                     throws java.io.IOException
Write a Commit to the object database

Parameters:
c - Commit to store
Returns:
SHA-1 of the commit
Throws:
java.io.IOException

writeTag

public ObjectId writeTag(Tag c)
                  throws java.io.IOException
Write an annotated Tag to the object database

Parameters:
c - Tag
Returns:
SHA-1 of the tag
Throws:
java.io.IOException

computeBlobSha1

public ObjectId computeBlobSha1(long len,
                                java.io.InputStream is)
                         throws java.io.IOException
Compute the SHA-1 of a blob without creating an object. This is for figuring out if we already have a blob or not.

Parameters:
len - number of bytes to consume
is - stream for read blob data from
Returns:
SHA-1 of a looked for blob
Throws:
java.io.IOException