org.eclipse.jgit.diff

## Class PatchIdDiffFormatter

- java.lang.Object
- - org.eclipse.jgit.diff.DiffFormatter
  - - org.eclipse.jgit.diff.PatchIdDiffFormatter

    public class PatchIdDiffFormatter
    extends DiffFormatter

A DiffFormatter used to calculate the patch-id of the diff.

### Constructor Summary

Constructors
Constructor and Description
`PatchIdDiffFormatter()` Initialize a formatter to compute a patch id.

### Method Summary

Methods
`protected void` `formatIndexLine(OutputStream o, DiffEntry ent)`
`ObjectId` `getCalulatedPatchId()` Should be called after having called one of the format methods
`protected void` `writeHunkHeader(int aStartLine, int aEndLine, int bStartLine, int bEndLine)` Output a hunk header

### Methods inherited from class org.eclipse.jgit.diff.DiffFormatter

`flush, format, format, format, format, format, format, format, formatGitDiffFirstHeaderLine, getNewPrefix, getOldPrefix, getOutputStream, getPathFilter, getRenameDetector, isDetectRenames, release, scan, scan, scan, setAbbreviationLength, setBinaryFileThreshold, setContext, setDetectRenames, setDiffAlgorithm, setDiffComparator, setNewPrefix, setOldPrefix, setPathFilter, setProgressMonitor, setRepository, toFileHeader, writeAddedLine, writeContextLine, writeLine, writeRemovedLine`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### PatchIdDiffFormatter

    public PatchIdDiffFormatter()

Initialize a formatter to compute a patch id.

### Method Detail

#### getCalulatedPatchId

    public ObjectId getCalulatedPatchId()

Should be called after having called one of the format methods

Returns:
  the patch id calculated for the provided diff.

#### writeHunkHeader

    protected void writeHunkHeader(int aStartLine,
                       int aEndLine,
                       int bStartLine,
                       int bEndLine)
                            throws IOException

Description copied from class: `DiffFormatter`
Output a hunk header

Overrides:
  `writeHunkHeader` in class `DiffFormatter`
Parameters:
  `aStartLine` - within first source
  `aEndLine` - within first source
  `bStartLine` - within second source
  `bEndLine` - within second source
Throws:
  `IOException`

#### formatIndexLine

    protected void formatIndexLine(OutputStream o,
                       DiffEntry ent)
                            throws IOException

Overrides:
  `formatIndexLine` in class `DiffFormatter`
Parameters:
  `o` - the stream the formatter will write line data to
  `ent` - the DiffEntry to create the FileHeader for
Throws:
  `IOException` - writing to the supplied stream failed.