Class: Amp::Core::Repositories::Git::Encoding::BinaryDelta::Hunk Private

Inherits:
Object
  • Object
show all
Defined in:
lib/amp-git/encoding/binary_delta.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class Method Summary collapse

Class Method Details

.parse(fp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parses a hunk from the input stream. Each hunk is an action: either a a copy from an input stream, or an “insert” which inserts specified data.



98
99
100
101
102
103
104
105
# File 'lib/amp-git/encoding/binary_delta.rb', line 98

def self.parse(fp)
  opcode = Support::HexString.from_bin(fp.read(1)).ord
  if opcode & 0x80 == 0
    InsertHunk.new(opcode, fp)
  else
    CopyHunk.new(opcode, fp)
  end
end