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()
IArtifactSinkgetArtifactToBeWritten in interface IArtifactSinkpublic boolean canBeginWrite()
IArtifactSinkIArtifactSink.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 IArtifactSinktrue if IArtifactSink.beginWrite() can be called on this instance.public java.io.OutputStream beginWrite()
throws ArtifactSinkException
IArtifactSinkbeginWrite in interface IArtifactSinkOutputStream 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
IArtifactSinkOutputStream returned by IArtifactSink.beginWrite().commitWrite in interface IArtifactSinkArtifactSinkException - if an error occurs while committing the write operation.public void abortWrite()
throws ArtifactSinkException
IArtifactSinkabortWrite in interface IArtifactSinkArtifactSinkException - if an error occurs while aborting the write operation.