Class StreamArtifactSink
- java.lang.Object
-
- org.eclipse.tycho.repository.p2base.artifact.provider.streaming.StreamArtifactSink
-
- All Implemented Interfaces:
IArtifactSink
- Direct Known Subclasses:
StreamRawArtifactSink
class StreamArtifactSink extends java.lang.Object implements IArtifactSink
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.OutputStreamdestinationprivate org.eclipse.equinox.p2.metadata.IArtifactKeyrequestedKeyprivate booleanwriteStarted
-
Constructor Summary
Constructors Constructor Description StreamArtifactSink(org.eclipse.equinox.p2.metadata.IArtifactKey requestedKey, java.io.OutputStream destination)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortWrite()Method for aborting the write operation.java.io.OutputStreambeginWrite()Method for starting the write operation.booleancanBeginWrite()Check ifIArtifactSink.beginWrite()can be called on this instance.voidcommitWrite()Method to committing the write operation.org.eclipse.equinox.p2.metadata.IArtifactKeygetArtifactToBeWritten()Returns the key of the artifact expected by this instance.
-
-
-
Method Detail
-
getArtifactToBeWritten
public org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
Description copied from interface:IArtifactSinkReturns the key of the artifact expected by this instance.- Specified by:
getArtifactToBeWrittenin interfaceIArtifactSink
-
canBeginWrite
public boolean canBeginWrite()
Description copied from interface:IArtifactSinkCheck ifIArtifactSink.beginWrite()can be called on this instance. This method will typically returnfalseifIArtifactSink.commitWrite()has already been called on this instance, or ifIArtifactSink.beginWrite()has been called before and the instance doesn't support re-starting the write operation.- Specified by:
canBeginWritein interfaceIArtifactSink- Returns:
trueifIArtifactSink.beginWrite()can be called on this instance.
-
beginWrite
public java.io.OutputStream beginWrite() throws ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod for starting the write operation. If this method has been called before, any content written so far will be discarded.- Specified by:
beginWritein interfaceIArtifactSink- Returns:
- the
OutputStreamto 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, callIArtifactSink.commitWrite()orIArtifactSink.abortWrite()to free any allocated resources. - Throws:
ArtifactSinkException- if an error occurs while starting the write operation.
-
commitWrite
public void commitWrite() throws ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod to committing the write operation. Will be called after the entire artifact content has been successfully streamed to theOutputStreamreturned byIArtifactSink.beginWrite().- Specified by:
commitWritein interfaceIArtifactSink- Throws:
ArtifactSinkException- if an error occurs while committing the write operation.
-
abortWrite
public void abortWrite() throws ArtifactSinkExceptionDescription copied from interface:IArtifactSinkMethod for aborting the write operation. Should be called if an error is detected while streaming the artifact content.- Specified by:
abortWritein interfaceIArtifactSink- Throws:
ArtifactSinkException- if an error occurs while aborting the write operation.
-
-