KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > compare > IStreamMerger


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.compare;
12
13 import java.io.InputStream JavaDoc;
14 import java.io.OutputStream JavaDoc;
15
16 import org.eclipse.core.runtime.IProgressMonitor;
17 import org.eclipse.core.runtime.IStatus;
18
19 /**
20  * This interface defines a single operation for performing a three-way merge on three
21  * input streams. The merged result is written to an output stream.
22  * <p>
23  * Clients must implement this interface when contributing new mergers to the
24  * <code>org.eclipse.compare.streamMergers</code> extension point.
25  * </p>
26  *
27  * @since 3.0
28  */

29 public interface IStreamMerger {
30
31     /**
32      * Indicates the successful completion of the merge operation (value <code>IStatus.OK</code>)
33      */

34     public static final int OK= IStatus.OK;
35     
36     /**
37      * Indicates that a change conflict prevented the merge from successful completion (value <code>1</code>)
38      */

39     public static final int CONFLICT= 1;
40     
41     /**
42      * Status code describing an internal error (value <code>2</code>)
43      */

44    public static final int INTERNAL_ERROR= 2;
45     
46     /**
47      * Performs a merge operation on the given input streams and writes the merge result to the output stream.
48      * On success a status <code>IStatus.OK</code> is returned, on error a status <code>IStatus.ERROR</code>.
49      * If the merge operation cannot deal with conflicts, the code of the error status has the value <code>IStreamMerger.CONFLICT</code>.
50      * For text oriented mergers the encoding for the input and output streams is honored.
51      * It is the responsibility of callers to close input and output streams.
52      *
53      * @param output the byte stream to which the merge result is written; the merger will not close the stream
54      * @param outputEncoding the encoding to use when writing to the output stream
55      * @param ancestor the byte stream from which the common ancestor is read
56      * @param ancestorEncoding the encoding of the ancestor input byte stream
57      * @param target the byte stream containing the target of the merge
58      * @param targetEncoding the encoding of the target input byte stream
59      * @param other the byte stream containing the target of the merge
60      * @param otherEncoding the encoding of the other input byte stream
61      * @param monitor reports progress of the merge operation
62      * @return returns the completion status of the operation
63      */

64     IStatus merge(OutputStream JavaDoc output, String JavaDoc outputEncoding,
65             InputStream JavaDoc ancestor, String JavaDoc ancestorEncoding,
66             InputStream JavaDoc target, String JavaDoc targetEncoding,
67             InputStream JavaDoc other, String JavaDoc otherEncoding,
68                 IProgressMonitor monitor);
69 }
70
Popular Tags