class StreamArtifactSink extends java.lang.Object implements IArtifactSink
Modifier and Type | Field and Description |
---|---|
private java.io.OutputStream |
destination |
private org.eclipse.equinox.p2.metadata.IArtifactKey |
requestedKey |
private boolean |
writeStarted |
Constructor and Description |
---|
StreamArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey requestedKey,
java.io.OutputStream destination) |
Modifier and Type | Method and Description |
---|---|
void |
abortWrite()
Method for aborting the write operation.
|
java.io.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.metadata.IArtifactKey |
getArtifactToBeWritten()
Returns the key of the artifact expected by this instance.
|
private org.eclipse.equinox.p2.metadata.IArtifactKey requestedKey
private java.io.OutputStream destination
private boolean writeStarted
StreamArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey requestedKey, java.io.OutputStream destination)
public org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
IArtifactSink
getArtifactToBeWritten
in interface IArtifactSink
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 java.io.OutputStream beginWrite() throws 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.ArtifactSinkException
- if an error occurs while starting the write operation.public void commitWrite() throws ArtifactSinkException
IArtifactSink
OutputStream
returned by IArtifactSink.beginWrite()
.commitWrite
in interface IArtifactSink
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.