summaryrefslogtreecommitdiff
path: root/lib/stdlib/test/shell_docs_SUITE_data/unknown_erlang_term_to_binary_2_func.txt
blob: f72b5be32c065aefd083116f94db536acf5a58a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

  -spec term_to_binary(Term, Options) -> ext_binary()
                          when
                              Term :: term(),
                              Options ::
                                  [compressed |
                                   {compressed, Level :: 0..9} |
                                   deterministic |
                                   {minor_version, Version :: 0..2}].

  Returns a binary data object that is the result of encoding Term
  according to the Erlang external term format.

  If option compressed is provided, the external term format is
  compressed. The compressed format is automatically recognized by 
  binary_to_term/1 as from Erlang/OTP R7B.

  A compression level can be specified by giving option 
  {compressed, Level}. Level is an integer with range 0..9,
  where:

   • 0 - No compression is done (it is the same as giving no 
     compressed option).

   • 1 - Takes least time but may not compress as well as the
     higher levels.

   • 6 - Default level when option compressed is provided.

   • 9 - Takes most time and tries to produce a smaller result.
     Notice "tries" in the preceding sentence; depending on the
     input term, level 9 compression either does or does not
     produce a smaller result than level 1 compression.

  Option {minor_version, Version} can be used to control some
  encoding details. This option was introduced in Erlang/OTP R11B-4.
  The valid values for Version are:

  0:
    Floats are encoded using a textual representation. This option
    is useful to ensure that releases before Erlang/OTP R11B-4 can
    decode resulting binary.

    This version encode atoms that can be represented by a latin1
    string using latin1 encoding while only atoms that cannot be
    represented by latin1 are encoded using utf8.

  1:
    This is as of Erlang/OTP 17.0 the default. It forces any
    floats in the term to be encoded in a more space-efficient and
    exact way (namely in the 64-bit IEEE format, rather than
    converted to a textual representation). As from Erlang/OTP
    R11B-4, binary_to_term/1 can decode this representation.

    This version encode atoms that can be represented by a latin1
    string using latin1 encoding while only atoms that cannot be
    represented by latin1 are encoded using utf8.

  2:
    Drops usage of the latin1 atom encoding and unconditionally
    use utf8 encoding for all atoms. Erlang/OTP systems as of R16B
    can decode this representation.

    Note:
      In Erlang/OTP 26, the default minor_version is planned
      to change from 1 to 2. See Upcoming Potential
      Incompatibilities .

  Option deterministic (introduced in OTP 24.1) can be used to
  ensure that within the same major release of Erlang/OTP, the same
  encoded representation is returned for the same term. There is
  still no guarantee that the encoded representation remains the
  same between major releases of Erlang/OTP.

  See also binary_to_term/1.