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

public abstract Class RefWriter

extends Object
Class Inheritance
Imports
java.io.IOException, .StringWriter, java.util.Collection, .Map, org.eclipse.jgit.internal.storage.file.RefDirectory, org.eclipse.jgit.util.RefList, .RefMap

Writes out refs to the org.eclipse.jgit.lib.Constants#INFO_REFS and org.eclipse.jgit.lib.Constants#PACKED_REFS files. This class is abstract as the writing of the files must be handled by the caller. This is because it is used by transport classes as well.

Field Summary

Modifier and TypeField and Description
private final Collection<Ref>

Constructor Summary

AccessConstructor and Description
public
RefWriter(Collection<Ref>
the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.
refs
)

Constructor for RefWriter.

public
RefWriter(Map<String, Ref>
the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.
refs
)

Constructor for RefWriter.

public
RefWriter(RefList<Ref>
the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.
refs
)

Constructor for RefWriter.

Method Summary

Modifier and TypeMethod and Description
protected abstract void
writeFile(String
path to ref file.
file
,
byte[]
byte content of file to be written.
content
)

Handles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport.

public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

refsback to summary
private final Collection<Ref> refs

Constructor Detail

RefWriterback to summary
public RefWriter(Collection<Ref> refs)

Constructor for RefWriter.

Parameters
refs:Collection<Ref>

the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.

RefWriterback to summary
public RefWriter(Map<String, Ref> refs)

Constructor for RefWriter.

Parameters
refs:Map<String, Ref>

the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.

RefWriterback to summary
public RefWriter(RefList<Ref> refs)

Constructor for RefWriter.

Parameters
refs:RefList<Ref>

the complete set of references. This should have been computed by applying updates to the advertised refs already discovered.

Method Detail

writeFileback to summary
protected abstract void writeFile(String file, byte[] content) throws IOException

Handles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport.

Parameters
file:String

path to ref file.

content:byte[]

byte content of file to be written.

Exceptions
IOException:
if an IO error occurred
writeInfoRefsback to summary
public void writeInfoRefs() throws IOException

Rebuild the org.eclipse.jgit.lib.Constants#INFO_REFS.

This method rebuilds the contents of the org.eclipse.jgit.lib.Constants#INFO_REFS file to match the passed list of references.

Exceptions
IOException:
writing is not supported, or attempting to write the file failed, possibly due to permissions or remote disk full, etc.
writePackedRefsback to summary
public void writePackedRefs() throws IOException

Rebuild the org.eclipse.jgit.lib.Constants#PACKED_REFS file.

This method rebuilds the contents of the org.eclipse.jgit.lib.Constants#PACKED_REFS file to match the passed list of references, including only those refs that have a storage type of org.eclipse.jgit.lib.Ref.Storage#PACKED.

Exceptions
IOException:
writing is not supported, or attempting to write the file failed, possibly due to permissions or remote disk full, etc.