public class NonStartableArtifactSink extends Object implements IRawArtifactSink
Constructor and Description |
---|
NonStartableArtifactSink() |
Modifier and Type | Method and Description |
---|---|
void |
abortWrite()
Method for aborting the write operation.
|
OutputStream |
beginWrite()
Method for starting the write operation.
|
boolean |
canBeginWrite()
Check if
IArtifactSink.beginWrite() can be called on this instance. |
void |
commitWrite()
Method to committing the write operation.
|
org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor |
getArtifactFormatToBeWritten()
Returns the format (and key) of the artifact to be written.
|
org.eclipse.equinox.p2.metadata.IArtifactKey |
getArtifactToBeWritten()
Returns the key of the artifact expected by this instance.
|
public org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
IArtifactSink
getArtifactToBeWritten
in interface IArtifactSink
public org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor getArtifactFormatToBeWritten()
IRawArtifactSink
Note: The artifact key that can be obtained via this method is the same as the key returned
by IArtifactSink.getArtifactToBeWritten()
, i.e.
sink.getArtifactDescriptorToBeWritten().getArtifactKey().equals(sink.getArtifactToBeWritten())
holds true.
getArtifactFormatToBeWritten
in interface IRawArtifactSink
public boolean canBeginWrite()
IArtifactSink
IArtifactSink.beginWrite()
can be called on this instance. This method will typically
return false
if IArtifactSink.commitWrite()
has already been called on this instance,
or if IArtifactSink.beginWrite()
has been called before and the instance doesn't support
re-starting the write operation.canBeginWrite
in interface IArtifactSink
true
if IArtifactSink.beginWrite()
can be called on this instance.public OutputStream beginWrite() throws IllegalStateException, ArtifactSinkException
IArtifactSink
beginWrite
in interface IArtifactSink
OutputStream
to write the artifact content to. The ownership of the
stream is not transferred to the caller, i.e. OutputStream.close()
must not be called on the returned instance. Instead, call IArtifactSink.commitWrite()
or
IArtifactSink.abortWrite()
to free any allocated resources.IllegalStateException
- if this instance is not in the right state to start a write operation. This
exception will be thrown if and only if IArtifactSink.canBeginWrite()
returns
false
.ArtifactSinkException
- if an error occurs while starting the write operation.public void commitWrite() throws IllegalStateException, ArtifactSinkException
IArtifactSink
OutputStream
returned by IArtifactSink.beginWrite()
.commitWrite
in interface IArtifactSink
IllegalStateException
- if there is no running write operation, i.e. when this method has already been
called, IArtifactSink.abortWrite()
has been called, or IArtifactSink.beginWrite()
has not
been called.ArtifactSinkException
- if an error occurs while committing the write operation.public void abortWrite() throws ArtifactSinkException
IArtifactSink
abortWrite
in interface IArtifactSink
ArtifactSinkException
- if an error occurs while aborting the write operation.Copyright © 2008–2014 Eclipse Foundation. All rights reserved.