晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 sh-3ll

HOME


sh-3ll 1.0
DIR:/opt/alt/ruby18/share/ri/1.8/system/Array/
Upload File :
Current File : //opt/alt/ruby18/share/ri/1.8/system/Array/pack-i.yaml
--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Packs the contents of <em>arr</em> into a binary sequence according to the directives in <em>aTemplateString</em> (see the table below) Directives ``A,'' ``a,'' and ``Z'' may be followed by a count, which gives the width of the resulting field. The remaining directives also may take a count, indicating the number of array elements to convert. If the count is an asterisk (``<tt>*</tt>''), all remaining array elements will be converted. Any of the directives ``<tt>sSiIlL</tt>'' may be followed by an underscore (``<tt>_</tt>'') to use the underlying platform's native size for the specified type; otherwise, they use a platform-independent size. Spaces are ignored in the template string. See also <tt>String#unpack</tt>.
- !ruby/struct:SM::Flow::VERB 
  body: "   a = [ &quot;a&quot;, &quot;b&quot;, &quot;c&quot; ]\n   n = [ 65, 66, 67 ]\n   a.pack(&quot;A3A3A3&quot;)   #=&gt; &quot;a  b  c  &quot;\n   a.pack(&quot;a3a3a3&quot;)   #=&gt; &quot;a\\000\\000b\\000\\000c\\000\\000&quot;\n   n.pack(&quot;ccc&quot;)      #=&gt; &quot;ABC&quot;\n"
- !ruby/struct:SM::Flow::P 
  body: Directives for <tt>pack</tt>.
- !ruby/struct:SM::Flow::VERB 
  body: " Integer   | Array   |\n Directive | Element | Meaning\n ------------------------------------------------------------------------\n    C      | Integer | 8-bit unsigned integer (unsigned char)\n    S      | Integer | 16-bit unsigned integer, native endian (uint16_t)\n    L      | Integer | 32-bit unsigned integer, native endian (uint32_t)\n    Q      | Integer | 64-bit unsigned integer, native endian (uint64_t)\n           |         |\n    c      | Integer | 8-bit signed integer (char)\n    s      | Integer | 16-bit signed integer, native endian (int16_t)\n    l      | Integer | 32-bit signed integer, native endian (int32_t)\n    q      | Integer | 64-bit signed integer, native endian (int64_t)\n           |         |\n    S_     | Integer | unsigned short, native endian\n    I, I_  | Integer | unsigned int, native endian\n    L_     | Integer | unsigned long, native endian\n           |         |\n    s_     | Integer | signed short, native endian\n    i, i_  | Integer | signed int, native endian\n    l_     | Integer | signed long, native endian\n           |         |\n    n      | Integer | 16-bit unsigned integer, network (big-endian) byte order\n    N      | Integer | 32-bit unsigned integer, network (big-endian) byte order\n    v      | Integer | 16-bit unsigned integer, VAX (little-endian) byte order\n    V      | Integer | 32-bit unsigned integer, VAX (little-endian) byte order\n           |         |\n    U      | Integer | UTF-8 character\n    w      | Integer | BER-compressed integer\n\n Float     |         |\n Directive |         | Meaning\n ------------------------------------------------------------------------\n    D, d   | Float   | double-precision float, native format\n    F, f   | Float   | single-precision float, native format\n    E      | Float   | double-precision float, little-endian byte order\n    e      | Float   | single-precision float, little-endian byte order\n    G      | Float   | double-precision float, network (big-endian) byte order\n    g      | Float   | single-precision float, network (big-endian) byte order\n\n String    |         |\n Directive |         | Meaning\n ------------------------------------------------------------------------\n    A      | String  | arbitrary binary string (space padded, count is width)\n    a      | String  | arbitrary binary string (null padded, count is width)\n    Z      | String  | same as ``a'', except that null is added with *\n    B      | String  | bit string (MSB first)\n    b      | String  | bit string (LSB first)\n    H      | String  | hex string (high nibble first)\n    h      | String  | hex string (low nibble first)\n    u      | String  | UU-encoded string\n    M      | String  | quoted printable, MIME encoding (see RFC2045)\n    m      | String  | base64 encoded string (see RFC 2045, count is width)\n    P      | String  | pointer to a structure (fixed-length string)\n    p      | String  | pointer to a null-terminated string\n\n Misc.     |         |\n Directive |         | Meaning\n ------------------------------------------------------------------------\n    @      | ---     | moves to absolute position\n    X      | ---     | back up a byte\n    x      | ---     | null byte\n"
full_name: Array#pack
is_singleton: false
name: pack
params: |
  arr.pack ( aTemplateString ) -> aBinaryString

visibility: public