Linux heracles.o2switch.net 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64
/
opt
/
alt
/
ruby21
/
share
/
ri
/
2.1.0
/
system
/
Array
/
//opt/alt/ruby21/share/ri/2.1.0/system/Array/pack-i.ri
U:RDoc::AnyMethod[iI" pack:ETI"Array#pack;TF:publico:RDoc::Markup::Document:@parts[o:RDoc::Markup::Paragraph; [I"JPacks the contents of <i>arr</i> into a binary sequence according to ;TI"Dthe directives in <i>aTemplateString</i> (see the table below) ;TI"DDirectives ``A,'' ``a,'' and ``Z'' may be followed by a count, ;TI"Awhich gives the width of the resulting field. The remaining ;TI"Fdirectives also may take a count, indicating the number of array ;TI"6elements to convert. If the count is an asterisk ;TI"@(``<code>*</code>''), all remaining array elements will be ;TI"Econverted. Any of the directives ``<code>sSiIlL</code>'' may be ;TI"7followed by an underscore (``<code>_</code>'') or ;TI"Aexclamation mark (``<code>!</code>'') to use the underlying ;TI"Jplatform's native size for the specified type; otherwise, they use a ;TI"Cplatform-independent size. Spaces are ignored in the template ;TI"1string. See also <code>String#unpack</code>.;To:RDoc::Markup::BlankLine o:RDoc::Markup::Verbatim; [ I"a = [ "a", "b", "c" ] ;TI"n = [ 65, 66, 67 ] ;TI"(a.pack("A3A3A3") #=> "a b c " ;TI":a.pack("a3a3a3") #=> "a\000\000b\000\000c\000\000" ;TI""n.pack("ccc") #=> "ABC" ;T:@format0o; ; [I"Directives for +pack+.;T@o;; [WI"Integer | Array | ;TI"&Directive | Element | Meaning ;TI"Q--------------------------------------------------------------------------- ;TI"= C | Integer | 8-bit unsigned (unsigned char) ;TI"H S | Integer | 16-bit unsigned, native endian (uint16_t) ;TI"H L | Integer | 32-bit unsigned, native endian (uint32_t) ;TI"H Q | Integer | 64-bit unsigned, native endian (uint64_t) ;TI" | | ;TI"9 c | Integer | 8-bit signed (signed char) ;TI"E s | Integer | 16-bit signed, native endian (int16_t) ;TI"E l | Integer | 32-bit signed, native endian (int32_t) ;TI"E q | Integer | 64-bit signed, native endian (int64_t) ;TI" | | ;TI"< S_, S! | Integer | unsigned short, native endian ;TI": I, I_, I! | Integer | unsigned int, native endian ;TI"; L_, L! | Integer | unsigned long, native endian ;TI"O Q_, Q! | Integer | unsigned long long, native endian (ArgumentError ;TI"F | | if the platform has no long long type.) ;TI"G | | (Q_ and Q! is available since Ruby 2.1.) ;TI" | | ;TI": s_, s! | Integer | signed short, native endian ;TI"8 i, i_, i! | Integer | signed int, native endian ;TI"9 l_, l! | Integer | signed long, native endian ;TI"M q_, q! | Integer | signed long long, native endian (ArgumentError ;TI"F | | if the platform has no long long type.) ;TI"G | | (q_ and q! is available since Ruby 2.1.) ;TI" | | ;TI"H S> L> Q> | Integer | same as the directives without ">" except ;TI") s> l> q> | | big endian ;TI"; S!> I!> | | (available since Ruby 1.9.3) ;TI"2 L!> Q!> | | "S>" is same as "n" ;TI"2 s!> i!> | | "L>" is same as "N" ;TI" l!> q!> | | ;TI" | | ;TI"H S< L< Q< | Integer | same as the directives without "<" except ;TI", s< l< q< | | little endian ;TI"; S!< I!< | | (available since Ruby 1.9.3) ;TI"2 L!< Q!< | | "S<" is same as "v" ;TI"2 s!< i!< | | "L<" is same as "V" ;TI" l!< q!< | | ;TI" | | ;TI"O n | Integer | 16-bit unsigned, network (big-endian) byte order ;TI"O N | Integer | 32-bit unsigned, network (big-endian) byte order ;TI"N v | Integer | 16-bit unsigned, VAX (little-endian) byte order ;TI"N V | Integer | 32-bit unsigned, VAX (little-endian) byte order ;TI" | | ;TI". U | Integer | UTF-8 character ;TI"5 w | Integer | BER-compressed integer ;TI" ;TI"Float | | ;TI"&Directive | | Meaning ;TI"Q--------------------------------------------------------------------------- ;TI"> D, d | Float | double-precision, native format ;TI"> F, f | Float | single-precision, native format ;TI"I E | Float | double-precision, little-endian byte order ;TI"I e | Float | single-precision, little-endian byte order ;TI"P G | Float | double-precision, network (big-endian) byte order ;TI"P g | Float | single-precision, network (big-endian) byte order ;TI" ;TI"String | | ;TI"&Directive | | Meaning ;TI"Q--------------------------------------------------------------------------- ;TI"U A | String | arbitrary binary string (space padded, count is width) ;TI"T a | String | arbitrary binary string (null padded, count is width) ;TI"N Z | String | same as ``a'', except that null is added with * ;TI"5 B | String | bit string (MSB first) ;TI"5 b | String | bit string (LSB first) ;TI"= H | String | hex string (high nibble first) ;TI"< h | String | hex string (low nibble first) ;TI"0 u | String | UU-encoded string ;TI"L M | String | quoted printable, MIME encoding (see RFC2045) ;TI"S m | String | base64 encoded string (see RFC 2045, count is width) ;TI"T | | (if count is 0, no line feed are added, see RFC 4648) ;TI"K P | String | pointer to a structure (fixed-length string) ;TI"B p | String | pointer to a null-terminated string ;TI" ;TI"Misc. | | ;TI"&Directive | | Meaning ;TI"Q--------------------------------------------------------------------------- ;TI"9 @ | --- | moves to absolute position ;TI"- X | --- | back up a byte ;TI"' x | --- | null byte;T; 0: @fileI"pack.c;T:0@omit_headings_from_table_of_contents_below0I"3arr.pack ( aTemplateString ) -> aBinaryString ;T0[ I" (p1);T@yFI" Array;TcRDoc::NormalClass00