Class: Zip64::InfoZipNewUnixExtraField

Inherits:
Block
  • Object
show all
Defined in:
lib/zip64/structures.rb

Constant Summary collapse

SIG =
0x7875
MAP =
{ 1 => 'C', 2 => 'v', 4 => 'V'}

Instance Method Summary collapse

Methods inherited from Block

base_size, #describe, #fields, fields, #initialize, read_from, #size, #size_of, size_of, #to_string

Constructor Details

This class inherits a constructor from Block

Instance Method Details

#pack_field(field) ⇒ Object



343
344
345
346
347
348
349
350
351
352
353
354
# File 'lib/zip64/structures.rb', line 343

def pack_field(field)
	case field.name
	when :uid
		type = MAP[@uid_size]
		[@uid].pack(type).zip64_force_encoding('ASCII-8BIT')
	when :gid
		type = MAP[@gid_size]
		[@gid].pack(type).zip64_force_encoding('ASCII-8BIT')
	else
		super
	end
end

#read_field_from(fp, field) ⇒ Object



356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/zip64/structures.rb', line 356

def read_field_from(fp, field)
	case field.name
	when :uid
		type = MAP[@uid_size]
		@uid = fp.read(@uid_size).unpack(type).first
	when :gid
		type = MAP[@gid_size]
		@gid = fp.read(@gid_size).unpack(type).first
	else
		super
	end
end