Пример #1
0
 /**
  * @see org.eclipse.jgit.diff.DiffFormatter#writeLine(char, org.eclipse.jgit.diff.RawText, int)
  */
 protected void writeLine(char prefix, RawText text, int cur) throws IOException {
   if (prefix == ' ') {
     super.writeLine(prefix, text, cur);
     stream.flushLine();
   } else {
     Type type = prefix == '+' ? Type.ADD : Type.REMOVE;
     int start = stream.offset;
     super.writeLine(prefix, text, cur);
     stream.flushLine();
     addRange(type, start, stream.offset);
   }
 }
Пример #2
0
    /**
     * write the blocks to a stream
     *
     * @param stream the stream to which the data is to be written
     */
    void writeBlocks(OutputStream stream) throws IOException {
      if (isValid()) {
        if (_writer != null) {
          DocumentOutputStream dstream = new DocumentOutputStream(stream, _size);

          _writer.processPOIFSWriterEvent(new POIFSWriterEvent(dstream, _path, _name, _size));
          dstream.writeFiller(
              countBlocks() * _bigBlockSize.getBigBlockSize(), DocumentBlock.getFillByte());
        } else {
          for (int k = 0; k < bigBlocks.length; k++) {
            bigBlocks[k].writeBlocks(stream);
          }
        }
      }
    }
Пример #3
0
 /** @see org.eclipse.jgit.diff.DiffFormatter#writeHunkHeader(int, int, int, int) */
 protected void writeHunkHeader(int aStartLine, int aEndLine, int bStartLine, int bEndLine)
     throws IOException {
   int start = stream.offset;
   super.writeHunkHeader(aStartLine, aEndLine, bStartLine, bEndLine);
   stream.flushLine();
   addRange(Type.HUNK, start, stream.offset);
 }
Пример #4
0
 /**
  * @see org.eclipse.jgit.diff.DiffFormatter#formatGitDiffFirstHeaderLine(ByteArrayOutputStream o,
  *     ChangeType type, String oldPath, String newPath)
  */
 @Override
 protected void formatGitDiffFirstHeaderLine(
     ByteArrayOutputStream o, final ChangeType type, final String oldPath, final String newPath)
     throws IOException {
   stream.flushLine();
   int offset = stream.offset;
   int start = o.size();
   super.formatGitDiffFirstHeaderLine(o, type, oldPath, newPath);
   int end = o.size();
   addRange(Type.HEADLINE, offset + start, offset + end);
 }
Пример #5
0
 @Override
 public void format(final EditList edits, final RawText a, final RawText b) throws IOException {
   // Flush header before formatting of edits begin
   stream.flushLine();
   super.format(edits, a, b);
 }