- Reference manual
encoding(Encoding)results in a
- A Stream handle or alias
- Temporarily switch current output to the given stream. Redirection using with_output_to/2 guarantees the original output is restored, also if Goal fails or raises an exception. See also call_cleanup/2.
- Create an atom from the emitted characters. Please note the remark above.
- Create a string object as defined in section 5.2.
- Create a list of character codes from the emitted characters, similar to atom_codes/2.
- codes(-Codes, -Tail)
- Create a list of character codes as a difference list.
- Create a list of one-character atoms from the emitted characters, similar to atom_chars/2.
- chars(-Chars, -Tail)
- Create a list of one-character atoms as a difference list.
The predicates in this section provide fast binary I/O of arbitrary
Prolog terms, including cyclic terms and terms holding attributed
library(fastrw) is a SICSTus/Ciao
compatible library that extends the core primitives described below.
- Using write_canonical/2 allows or exchange of terms with other Prolog systems. The format is stable and, as it is text based, it can be inspected and corrected.
- Using the binary format improves the performance roughly 3 times.
- The size of both representations is comparable.
- The binary format can deal with cycles, sharing and attributes. Special precautions are needed to transfer such terms using write_canonical/2. See term_factorized/3 and copy_term/3.
- In the current version, reading the binary format has only incomplete consistency checks. This implies a user must be able to trust the source as crafted messages may compromise the reading Prolog system.
- fast_term_serialized(?Term, ?String)
- (De-)serialize Term to/from String.
- fast_write(+Output, +Term)
- Write Term using the fast serialization format to the Output stream. Output must be a binary stream.
- fast_read(+Input, -Term)
- Read Term using the fast serialization format from the Input stream. Input must be a binary stream.bugThe predicate fast_read/2 may crash on arbitrary input.