Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.compare.patch
Interface IHunk


public interface IHunk

Interface that represents a hunk. A hunk is a portion of a patch. It identifies where the hunk is to be located in the target file. One use of this interface is a means to communicate to content merge viewers that one of the sides of a compare input is a patch hunk. Clients can determine which side it is by adapting the side to this interface (see IAdaptable.

Since:
3.3
Restriction:
This interface is not intended to be implemented by clients but can be obtained from an IFilePatchResult

Method Summary
  String getCharset ()
          Deprecated. This method can be called before the first attempt to apply the hunk when it is impossible to determine the encoding and in this case it always returns null. Please see IFilePatchResult.getCharset() as a proper way to obtain charset.
  String getLabel ()
          Return a label that can be used to describe the hunk.
  InputStream getOriginalContents ()
          Return the original contents from which the hunk was generated.
  InputStream getPatchedContents ()
          Return the contents that contain the modifications for this hunk.
 int getStartPosition ()
          Return the start position of the hunk in the target file.
  String[] getUnifiedLines ()
          Returns hunk's content in the unified format.
 

Method Detail

getLabel

String getLabel()
Return a label that can be used to describe the hunk.

Returns:
a label that can be used to describe the hunk

getStartPosition

int getStartPosition()
Return the start position of the hunk in the target file.

Returns:
the start position of the hunk in the target file.

getUnifiedLines

String[] getUnifiedLines()
Returns hunk's content in the unified format. This is an internal format in which hunk stores its content and is always the same even if the hunk was extracted from a patch stored in a different format. In the unified format each line is prefixed with one of the following:
  • ' ' for context
  • '+' for addition
  • '-' for removal

Returns:
hunk's content in the unified format
Since:
org.eclipse.compare 3.5

getOriginalContents

InputStream getOriginalContents()
Return the original contents from which the hunk was generated. The returned contents usually only represent a portion of the file from which the hunk was generated.

Returns:
the original contents from which the hunk was generated

getPatchedContents

InputStream getPatchedContents()
Return the contents that contain the modifications for this hunk. The returned contents usually only represent a portion of the file that was modified.

Returns:
the contents that contain the modifications for this hunk

getCharset

String getCharset()
                  throws 
CoreException
Deprecated. This method can be called before the first attempt to apply the hunk when it is impossible to determine the encoding and in this case it always returns null. Please see IFilePatchResult.getCharset() as a proper way to obtain charset.

Returns the name of a charset encoding to be used when decoding the contents of this hunk 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.5

Guidelines for using Eclipse APIs.

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


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire