Class: LZ4::BasicStream::BlockHeader

Inherits:
Struct
  • Object
show all
Defined in:
lib/extlz4/oldstream.rb,
lib/extlz4/oldstream.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#iscompressObject Also known as: compress?

Returns the value of attribute iscompress

Returns:

  • (Object)

    the current value of iscompress



188
189
190
# File 'lib/extlz4/oldstream.rb', line 188

def iscompress
  @iscompress
end

#packedsizeObject

Returns the value of attribute packedsize

Returns:

  • (Object)

    the current value of packedsize



188
189
190
# File 'lib/extlz4/oldstream.rb', line 188

def packedsize
  @packedsize
end

Class Method Details

.load(io) ⇒ Object



211
212
213
# File 'lib/extlz4/oldstream.rb', line 211

def self.load(io)
  unpack io.read(4)
end

.pack(iscompress, packedsize) ⇒ Object



201
202
203
# File 'lib/extlz4/oldstream.rb', line 201

def self.pack(iscompress, packedsize)
  new(iscompress, packedsize).pack
end

.unpack(data) ⇒ Object



205
206
207
208
209
# File 'lib/extlz4/oldstream.rb', line 205

def self.unpack(data)
  d = data.unpack("V")[0]
  new((d & LITERAL_DATA_BLOCK_FLAG) == 0 ? true : false,
      packedsize & ~LITERAL_DATA_BLOCK_FLAG)
end

Instance Method Details

#packObject



197
198
199
# File 'lib/extlz4/oldstream.rb', line 197

def pack
  [(compress? ? 0 : LITERAL_DATA_BLOCK_FLAG) | packedsize].pack("V")
end