Eclipse Platform
Release 3.3

org.eclipse.compare.patch
Interface IFilePatchResult


public interface IFilePatchResult

A file patch result provides the results of an attempt to apply an IFilePatch to the contents of a file. *

This interface is not intended to be implemented by clients. Clients can obtain patch results from an IFilePatch.

Since:
3.3
See Also:
IFilePatch

Method Summary
 String getCharset()
          Returns the name of a charset encoding to be used when decoding the contents of this result into characters.
 InputStream getOriginalContents()
          Return a stream the contains the original contents of the file before any portions of the patch have been applied.
 InputStream getPatchedContents()
          Return a stream that contains the file with as much of the patch applied as possible. if hasMatches() returns false then the patched contents will match the original contents.
 IHunk[] getRejects()
          Return the portions of the patch (referred to a hunks) that could not be applied.
 boolean hasMatches()
          Return whether the patch has portions that were successfully applied.
 boolean hasRejects()
          Return whether the patch has portions that were not successfully applied.
 

Method Detail

getOriginalContents

public InputStream getOriginalContents()
Return a stream the contains the original contents of the file before any portions of the patch have been applied.

Returns:
a stream to the original contents of the file before any portions of the patch have been applied
See Also:
getPatchedContents()

getPatchedContents

public InputStream getPatchedContents()
Return a stream that contains the file with as much of the patch applied as possible. if hasMatches() returns false then the patched contents will match the original contents. Otherwise, at least a portion of the patch could be successfully applied. if hasRejects() returns false, then the entire patch was applied. Otherwise, portions could not be applied. The portions that could not be applied can be obtained by calling getRejects().

Returns:
a stream that contains the file with as much of the patch applied as possible.

hasMatches

public boolean hasMatches()
Return whether the patch has portions that were successfully applied.

Returns:
whether the patch has portions that were successfully applied
See Also:
getPatchedContents()

hasRejects

public boolean hasRejects()
Return whether the patch has portions that were not successfully applied.

Returns:
whether the patch has portions that were not successfully applied
See Also:
getPatchedContents()

getRejects

public IHunk[] getRejects()
Return the portions of the patch (referred to a hunks) that could not be applied.

Returns:
the portions of the patch (referred to a hunks) that could not be applied
See Also:
getPatchedContents()

getCharset

public String getCharset()
                  throws CoreException
Returns the name of a charset encoding to be used when decoding the contents of this result into characters. Returns null if a proper encoding cannot be determined.

Note that this method does not check whether the result is a supported charset name. Callers should be prepared to handle UnsupportedEncodingException where this charset is used.

Returns:
the name of a charset, or null
Throws:
CoreException - if an error happens while determining the charset. See any refinements for more information.
See Also:
IEncodedStorage

Eclipse Platform
Release 3.3

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.