Interface IArtifactSink

    • Method Detail

      • getArtifactToBeWritten

        org.eclipse.equinox.p2.metadata.IArtifactKey getArtifactToBeWritten()
        Returns the key of the artifact expected by this instance.
      • canBeginWrite

        boolean canBeginWrite()
        Check if beginWrite() can be called on this instance. This method will typically return false if commitWrite() has already been called on this instance, or if beginWrite() has been called before and the instance doesn't support re-starting the write operation.
        Returns:
        true if beginWrite() can be called on this instance.
      • beginWrite

        java.io.OutputStream beginWrite()
                                 throws java.lang.IllegalStateException,
                                        ArtifactSinkException
        Method for starting the write operation. If this method has been called before, any content written so far will be discarded.
        Returns:
        the 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 commitWrite() or abortWrite() to free any allocated resources.
        Throws:
        java.lang.IllegalStateException - if this instance is not in the right state to start a write operation. This exception will be thrown if and only if canBeginWrite() returns false.
        ArtifactSinkException - if an error occurs while starting the write operation.
      • commitWrite

        void commitWrite()
                  throws java.lang.IllegalStateException,
                         ArtifactSinkException
        Method to committing the write operation. Will be called after the entire artifact content has been successfully streamed to the OutputStream returned by beginWrite().
        Throws:
        java.lang.IllegalStateException - if there is no running write operation, i.e. when this method has already been called, abortWrite() has been called, or beginWrite() has not been called.
        ArtifactSinkException - if an error occurs while committing the write operation.
      • abortWrite

        void abortWrite()
                 throws ArtifactSinkException
        Method for aborting the write operation. Should be called if an error is detected while streaming the artifact content.
        Throws:
        ArtifactSinkException - if an error occurs while aborting the write operation.