ConverterOutputStream
Object Hierarchy:
Description:
[
CCode ( type_id =
"g_converter_output_stream_get_type ()" ) ]
public class ConverterOutputStream :
FilterOutputStream,
PollableOutputStream
Converter output stream implements OutputStream and allows conversion of data
of various types during reading.
As of GLib 2.34, ConverterOutputStream implements
PollableOutputStream.
Example: Charset conversion:
public static int main (string[] args) {
try {
MemoryOutputStream mostream = new MemoryOutputStream (null, GLib.realloc, GLib.free);
CharsetConverter oconverter = new CharsetConverter ("utf-16", "utf-8");
ConverterOutputStream costream = new ConverterOutputStream (mostream, oconverter);
DataOutputStream dostream = new DataOutputStream (costream);
dostream.put_string ("ΑαΒβΓγΔδΕεΖζΗηΘθ\n");
dostream.put_string ("ΙιΚκΛλΜμΝνΞξΟοΠπ\n");
dostream.put_string ("ΡρΣσΤτΥυΦφΧχΨψΩω\n");
mostream.close ();
Bytes bytes = mostream.steal_as_bytes ();
MemoryInputStream mistream = new MemoryInputStream.from_bytes (bytes);
CharsetConverter iconverter = new CharsetConverter ("utf-8", "utf-16");
ConverterInputStream cistream = new ConverterInputStream (mistream, iconverter);
DataInputStream distream = new DataInputStream (cistream);
string line = distream.read_line ();
print (@"$line\n");
line = distream.read_line ();
print (@"$line\n");
line = distream.read_line ();
print (@"$line\n");
} catch (IOError e) {
print ("IOError: %s\n", e.message);
} catch (Error e) {
print ("Error: %s\n", e.message);
}
return 0;
}
valac --pkg gio-2.0 GLib.CharsetConverter.vala
Content:
Properties:
Creation methods:
Methods:
Inherited Members:
All known members inherited from class GLib.FilterOutputStream
All known members inherited from class GLib.OutputStream
All known members inherited from class GLib.Object
- @get
- @new
- @ref
- @set
- add_toggle_ref
- add_weak_pointer
- bind_property
- connect
- constructed
- disconnect
- dispose
- dup_data
- dup_qdata
- force_floating
- freeze_notify
- get_class
- get_data
- get_property
- get_qdata
- get_type
- getv
- interface_find_property
- interface_install_property
- interface_list_properties
- is_floating
- new_valist
- new_with_properties
- newv
- notify
- notify_property
- ref_count
- ref_sink
- remove_toggle_ref
- remove_weak_pointer
- replace_data
- replace_qdata
- set_data
- set_data_full
- set_property
- set_qdata
- set_qdata_full
- set_valist
- setv
- steal_data
- steal_qdata
- thaw_notify
- unref
- watch_closure
- weak_ref
- weak_unref
All known members inherited from interface GLib.PollableOutputStream