Class: ISO9660
- Inherits:
-
Object
- Object
- ISO9660
- Defined in:
- lib/iso9660.rb
Defined Under Namespace
Class Method Summary collapse
-
.achar?(achar) ⇒ Boolean
Returns: bool.
-
.check_types ⇒ Object
class ISO9660.
-
.dchar?(dchar) ⇒ Boolean
Returns: bool.
-
.dirname_valid?(path) ⇒ Boolean
Returns: bool.
-
.name_translate(filename, joliet_level = 0) ⇒ Object
Returns: String.
-
.pathname_isofy(path, version = 1) ⇒ Object
Take path and a version number and turn that into a ISO-9660 pathname.
-
.pathname_valid?(path) ⇒ Boolean
Returns: bool.
-
.strncpy_pad(name, len, check) ⇒ Object
Returns: String.
Class Method Details
.achar?(achar) ⇒ Boolean
Returns: bool
Return 1 if achar is an ISO-9660 ACHAR. achar should either be a string of length one or the ord() of a string of length 1.
These are the DCHAR’s plus some ASCII symbols including the space symbol.
469 470 471 472 473 474 475 476 477 478 479 |
# File 'lib/iso9660.rb', line 469 def ISO9660.achar?(achar) if achar.class == Fixnum # Is an integer. Is it too large? if achar > 255 then return false end elsif achar.class == String and achar.length() == 1 achar = achar[0] else return false end return Rubyiso9660::achar?(achar) end |
.check_types ⇒ Object
class ISO9660
439 440 441 442 443 444 445 446 |
# File 'lib/iso9660.rb', line 439 def ISO9660.check_types() return { :nocheck => Rubyiso9660::NOCHECK, :"7bit" => Rubyiso9660::SEVEN_BIT, :achars => Rubyiso9660::ACHARS, :dchars => Rubyiso9660::DCHARS } end |
.dchar?(dchar) ⇒ Boolean
Returns: bool
Return 1 if dchar is a ISO-9660 DCHAR - a character that can appear in an an ISO-9600 level 1 directory name. These are the ASCII capital letters A-Z, the digits 0-9 and an underscore.
dchar should either be a string of length one or the ord() of a string of length 1.
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/iso9660.rb', line 489 def ISO9660.dchar?(dchar) if dchar.class == Fixnum # Is an integer. Is it too large? if dchar > 255 then return false end # Not integer. Should be a string of length one then. # We'll turn it into an integer. elsif dchar = dchar[0] else return false end return Rubyiso9660::dchar?(dchar) end |
.dirname_valid?(path) ⇒ Boolean
Returns: bool
Check that path is a valid ISO-9660 directory name.
A valid directory name should not start out with a slash (/), dot (.) or null byte, should be less than 37 characters long, have no more than 8 characters in a directory component which is separated by a /, and consist of only DCHARs.
true is returned if path is valid.
458 459 460 |
# File 'lib/iso9660.rb', line 458 def ISO9660.dirname_valid?(path) return Rubyiso9660::dirname_valid?(path) end |
.name_translate(filename, joliet_level = 0) ⇒ Object
Returns: String
Convert an ISO-9660 file name of the kind that is that stored in a ISO 9660 directory entry into what’s usually listed as the file name in a listing. Lowercase name if no Joliet Extension interpretation. Remove trailing ;1’s or .;1’s and turn the other ;‘s into version numbers.
If joliet_level is not given it is 0 which means use no Joliet Extensions. Otherwise use the specified the Joliet level.
The translated string is returned and it will be larger than the input filename.
538 539 540 |
# File 'lib/iso9660.rb', line 538 def ISO9660.name_translate(filename, joliet_level=0) return Rubyiso9660::name_translate_ext(filename, joliet_level) end |
.pathname_isofy(path, version = 1) ⇒ Object
Take path and a version number and turn that into a ISO-9660 pathname. (That’s just the pathname followed by ‘;’ and the version number. For example, mydir/file.ext -> MYDIR/FILE.EXT;1 for version 1. The resulting ISO-9660 pathname is returned.
522 523 524 |
# File 'lib/iso9660.rb', line 522 def ISO9660.pathname_isofy(path, version=1) return Rubyiso9660::pathname_isofy(path, version) end |
.pathname_valid?(path) ⇒ Boolean
Returns: bool
Check that path is a valid ISO-9660 pathname.
A valid pathname contains a valid directory name, if one appears and the filename portion should be no more than 8 characters for the file prefix and 3 characters in the extension (or portion after a dot). There should be exactly one dot somewhere in the filename portion and the filename should be composed of only DCHARs.
true is returned if path is valid.
514 515 516 |
# File 'lib/iso9660.rb', line 514 def ISO9660.pathname_valid?(path) return Rubyiso9660::pathname_valid?(path) end |
.strncpy_pad(name, len, check) ⇒ Object
Returns: String
Pad string ‘name’ with spaces to size len and return this. If ‘len’ is less than the length of ‘src’, the return value will be truncated to the first len characters of ‘name’.
‘name’ can also be scanned to see if it contains only ACHARs, DCHARs, or 7-bit ASCII chars, and this is specified via the ‘check’ parameter. If the I<check> parameter is given it must be one of the ‘nocheck’, ‘7bit’, ‘achars’ or ‘dchars’. Case is not significant.
558 559 560 561 562 563 564 |
# File 'lib/iso9660.rb', line 558 def ISO9660.strncpy_pad(name, len, check) if not ISO9660.check_types().member?(check) puts "*** A CHECK parameter must be one of %s\n" % ISO9660.check_types.keys().join(',') return nil end return Rubyiso9660::strncpy_pad(name, len, ISO9660.check_types()[check]) end |