org.eclipse.jgit.transport
Class TransportBundleStream

java.lang.Object
  extended by org.eclipse.jgit.transport.Transport
      extended by org.eclipse.jgit.transport.TransportBundleStream
All Implemented Interfaces:
PackTransport, TransportBundle

public class TransportBundleStream
extends Transport
implements TransportBundle

Single shot fetch from a streamed Git bundle.

The bundle is read from an unbuffered input stream, which limits the transport to opening at most one FetchConnection before needing to recreate the transport instance.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jgit.transport.Transport
Transport.Operation
 
Field Summary
 
Fields inherited from class org.eclipse.jgit.transport.Transport
DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri
 
Fields inherited from interface org.eclipse.jgit.transport.TransportBundle
V2_BUNDLE_SIGNATURE
 
Constructor Summary
TransportBundleStream(Repository db, URIish uri, InputStream in)
          Create a new transport to fetch objects from a streamed bundle.
 
Method Summary
 void close()
          Close any resources used by this transport.
 FetchConnection openFetch()
          Begins a new connection for fetching from the remote repository.
 PushConnection openPush()
          Begins a new connection for pushing into the remote repository.
 
Methods inherited from class org.eclipse.jgit.transport.Transport
applyConfig, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getOptionReceivePack, getOptionUploadPack, getPackConfig, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, openAll, openAll, openAll, openAll, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransportBundleStream

public TransportBundleStream(Repository db,
                             URIish uri,
                             InputStream in)
Create a new transport to fetch objects from a streamed bundle.

The stream can be unbuffered (buffering is automatically provided internally to smooth out short reads) and unpositionable (the stream is read from only once, sequentially).

When the FetchConnection or the this instance is closed the supplied input stream is also automatically closed. This frees callers from needing to keep track of the supplied stream.

Parameters:
db - repository the fetched objects will be loaded into.
uri - symbolic name of the source of the stream. The URI can reference a non-existent resource. It is used only for exception reporting.
in - the stream to read the bundle from.
Method Detail

openFetch

public FetchConnection openFetch()
                          throws TransportException
Description copied from class: Transport
Begins a new connection for fetching from the remote repository.

Specified by:
openFetch in class Transport
Returns:
a fresh connection to fetch from the remote repository.
Throws:
TransportException - the remote connection could not be established.

openPush

public PushConnection openPush()
                        throws NotSupportedException
Description copied from class: Transport
Begins a new connection for pushing into the remote repository.

Specified by:
openPush in class Transport
Returns:
a fresh connection to push into the remote repository.
Throws:
NotSupportedException - the implementation does not support pushing.

close

public void close()
Description copied from class: Transport
Close any resources used by this transport.

If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository.

Specified by:
close in class Transport


Copyright © 2012. All Rights Reserved.