Eclipse Platform
Release 3.6

org.eclipse.compare.patch
Interface IFilePatchResult


public interface IFilePatchResult

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

Since:
3.3
See Also:
IFilePatch2
Restriction:
This interface is not intended to be implemented by clients. Clients can obtain patch results from an IFilePatch2.

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

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

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

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

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

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

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.

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2010. All rights reserved.