Module trens

Trens: a portable GNU libiconv linkedin driver.

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/].

Description

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.

Data Types

eol()

eol() = no_eol | eol

mode()

mode() = strict | ignore | translit | both

Function Index

close/1Closes the Trens driver instance referenced by Port.
convert/2Equivalent to trens:convert(Port, Bin, 'no_eol').
convert/3Equivalent to trens:convert(Port, Bin, EOL, ?DEFAULT_CHUNK_SIZE).
convert/4Perform character set conversion on the specified binary, chunk by chunk.
list/0List the supported encodings.
open/0Create a Trens driver instance.
revision/0Returns the current Trens revision number.
setenc/2Equivalent to setenc(Port, FromEnc, <<"UTF-8">>).
setenc/3Equivalent to setenc(Port, FromEnc, ToEnc, 'strict').
setenc/4Set the input and output encodings.
start_link/0Start the Trens (a singleton instance) server.
stop/1Stop the Trens server.
version/0Returns the current Trens version number.

Function Details

close/1

close(Port::port()) -> ok

Closes the Trens driver instance referenced by Port. Deallocate all used resources for character set conversion.

convert/2

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/3

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/4

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/0

list() -> ok

List the supported encodings

open/0

open() -> port()

Create a Trens driver instance.

revision/0

revision() -> string()

Returns the current Trens revision number.

setenc/2

setenc(Port::port(), FromEnc::any()) -> ok

Equivalent to setenc(Port, FromEnc, <<"UTF-8">>).

setenc/3

setenc(Port::port(), FromEnc::any(), ToEnc::any()) -> ok

Equivalent to setenc(Port, FromEnc, ToEnc, 'strict').

setenc/4

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/0

start_link() -> {ok, pid()}

Start the Trens (a singleton instance) server. This call loads the driver.

stop/1

stop(Pid::pid() | atom()) -> ok

Stop the Trens server.

version/0

version() -> string()

Returns the current Trens version number.


Generated by EDoc, Apr 29 2013, 17:24:25.