public class TransportBundleStream extends Transport implements TransportBundle
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.
Transport.Operation
DEFAULT_FETCH_THIN, DEFAULT_PUSH_THIN, local, REFSPEC_PUSH_ALL, REFSPEC_TAGS, uri
V2_BUNDLE_SIGNATURE
Constructor and Description |
---|
TransportBundleStream(Repository db,
URIish uri,
InputStream in)
Create a new transport to fetch objects from a streamed bundle.
|
Modifier and Type | Method and Description |
---|---|
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.
|
applyConfig, fetch, findRemoteRefUpdatesFor, findRemoteRefUpdatesFor, getCredentialsProvider, getObjectChecker, getOptionReceivePack, getOptionUploadPack, getPackConfig, getTagOpt, getTimeout, getTransportProtocols, getURI, isCheckFetchedObjects, isDryRun, isFetchThin, isPushAtomic, isPushThin, isRemoveDeletedRefs, open, open, open, open, open, open, open, openAll, openAll, openAll, openAll, push, push, register, setCheckFetchedObjects, setCredentialsProvider, setDryRun, setFetchThin, setObjectChecker, setOptionReceivePack, setOptionUploadPack, setPackConfig, setPushAtomic, setPushThin, setRemoveDeletedRefs, setTagOpt, setTimeout, unregister
public TransportBundleStream(Repository db, URIish uri, InputStream in)
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.
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.public FetchConnection openFetch() throws TransportException
Transport
If the transport has no local repository, the fetch connection can only be used for reading remote refs.
openFetch
in class Transport
TransportException
- the remote connection could not be established.public PushConnection openPush() throws NotSupportedException
Transport
openPush
in class Transport
NotSupportedException
- the implementation does not support pushing.public void close()
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.
AutoClosable.close()
declares that it throws Exception
.
Implementers shouldn't throw checked exceptions. This override narrows
the signature to prevent them from doing so.
close
in interface AutoCloseable
close
in class Transport
Copyright © 2016 Eclipse JGit Project. All rights reserved.