Copyright © (c) 2010-2013 ALEPH ARCHIVES Ltd. All rights reserved [http://aleph-archives.com/]
Version: 1.14
Behaviours: ?GEN_SERVER.
Authors: Aleph Archives Ltd. [web site: http://aleph-archives.com/].
Trens: a portable GNU libiconv linkedin driver.
This module provides convenient function calls to start, stop, etc. a Trens server.
Trens offers stream capabilities over GNU libiconv in a sense that you can convert huge files with minimal/controlled RAM impact.eol() = no_eol | eol
mode() = strict | ignore | translit | both
close/1 | Closes the Trens driver instance referenced by Port. |
convert/2 | Equivalent to trens:convert(Port, Bin, 'no_eol'). |
convert/3 | Equivalent to trens:convert(Port, Bin, EOL, ?DEFAULT_CHUNK_SIZE). |
convert/4 | Perform character set conversion on the specified binary, chunk by chunk. |
list/0 | List the supported encodings. |
open/0 | Create a Trens driver instance. |
revision/0 | Returns the current Trens revision number. |
setenc/2 | Equivalent to setenc(Port, FromEnc, <<"UTF-8">>). |
setenc/3 | Equivalent to setenc(Port, FromEnc, ToEnc, 'strict'). |
setenc/4 | Set the input and output encodings. |
start_link/0 | Start the Trens (a singleton instance) server. |
stop/1 | Stop the Trens server. |
version/0 | Returns the current Trens version number. |
close(Port::port()) -> ok
Closes the Trens driver instance referenced by Port. Deallocate all used resources for character set conversion.
convert(Port::port(), Bin::binary() | iolist()) -> {more, binary(), binary()} | {ok, binary()}
Equivalent to trens:convert(Port, Bin, 'no_eol'). Means no "end of line" chars will be added to null-terminate the converted buffer.
convert(Port::port(), Bin::binary() | iolist(), EOL::eol()) -> {more, binary(), binary()} | {ok, binary()}
Equivalent to trens:convert(Port, Bin, EOL, ?DEFAULT_CHUNK_SIZE). The binary is splitted into chunks, each of size ?DEFAULT_CHUNK_SIZE (4096 bytes) before running the conversion.
convert(Port::port(), Bin::binary() | iolist(), EOL::eol(), ChunkSize::pos_integer()) -> {more, binary(), binary()} | {ok, binary()}
Perform character set conversion on the specified binary, chunk by chunk.
Note: not all multibyte charsets can be null-terminated with a single null byte. UCS2 needs 2 null bytes, and UCS4 needs 4.
Thus, you can ask "Trens" to append a 4 null bytes after a successful conversion if desired.
You can use the EOL mode to decide:list() -> ok
List the supported encodings
open() -> port()
Create a Trens driver instance.
revision() -> string()
Returns the current Trens revision number.
setenc(Port::port(), FromEnc::any()) -> ok
Equivalent to setenc(Port, FromEnc, <<"UTF-8">>).
setenc(Port::port(), FromEnc::any(), ToEnc::any()) -> ok
Equivalent to setenc(Port, FromEnc, ToEnc, 'strict').
setenc(Port::port(), FromEnc::any(), ToEnc::any(), Mode::mode()) -> ok
Set the input and output encodings. Also set the conversion mode: 'strict', 'ignore' (equiv. //IGNORE) 'translit' (equiv. to //TRANSLIT) or 'both' (equi. //TRANSLIT//IGNORE)
Allocate resources for character set conversion.start_link() -> {ok, pid()}
Start the Trens (a singleton instance) server. This call loads the driver.
stop(Pid::pid() | atom()) -> ok
Stop the Trens server.
version() -> string()
Returns the current Trens version number.
Generated by EDoc, Apr 29 2013, 17:24:25.