OutputStream
Object Hierarchy:
GLib.OutputStream
GLib.OutputStream
GLib.OutputStream
GLib.Object
GLib.Object
GLib.Object->GLib.OutputStream
Description:
[
CCode ( type_id =
"g_output_stream_get_type ()" ) ]
public abstract class OutputStream :
Object
Example: IOStream:
public static int main (string [] args) { try { // Create a file that can only be accessed by the current user: File file = File.new_for_path ("my-test.bin" ); IOStream ios = file.create_readwrite (FileCreateFlags.PRIVATE); // // Write data: // size_t bytes_written; OutputStream os = ios.output_stream; os.write_all ("My 1. line \n " .data, out bytes_written); os.write_all ("My 2. line \n " .data, out bytes_written); DataOutputStream dos = new DataOutputStream (os); dos.put_string ("My 3. line \n " ); dos.put_int16 (10 ); ios = null ; // Open the file for reading: InputStream @is = file.read (); // // Read n bytes: // // Output: ``M`` uint8 buffer[1 ]; size_t size = @is.read (buffer); stdout.write (buffer, size); // Output: ``y 1. line`` DataInputStream dis = new DataInputStream (@is); string str = dis.read_line (); print (" %s \n " , str); // Output: ``My 2. line`` str = dis.read_line (); print (" %s \n " , str); // Output: ``My 3. line`` str = dis.read_line (); print (" %s \n " , str); // Output: ``10`` int16 i = dis.read_int16 (); print (" %d \n " , i); } catch (Error e) { print ("Error: %s \n " , e.message); } return 0 ; }
valac --pkg gio-2.0 GLib.IOStream.vala
Content:
Creation methods:
Methods:
public void clear_pending ()
public abstract bool close (Cancellable ? cancellable = null ) throws IOError
public virtual async bool close_async (int io_priority = DEFAULT , Cancellable ? cancellable = null ) throws IOError
public virtual bool flush (Cancellable ? cancellable = null ) throws Error
public virtual async bool flush_async (int io_priority = DEFAULT , Cancellable ? cancellable = null ) throws Error
public bool has_pending ()
public bool is_closed ()
public bool is_closing ()
public bool printf (out size_t bytes_written, Cancellable ? cancellable, string format, ...) throws Error
public bool set_pending () throws Error
public virtual ssize_t splice (InputStream source, OutputStreamSpliceFlags flags, Cancellable ? cancellable = null ) throws IOError
public virtual async ssize_t splice_async (InputStream source, OutputStreamSpliceFlags flags, int io_priority = DEFAULT , Cancellable ? cancellable = null ) throws IOError
public bool vprintf (out size_t bytes_written, Cancellable ? cancellable, string format, va_list args) throws Error
public abstract ssize_t write (uint8 [] buffer, Cancellable ? cancellable = null ) throws IOError
public bool write_all (uint8 [] buffer, out size_t bytes_written, Cancellable ? cancellable = null ) throws IOError
public async bool write_all_async (uint8 [] buffer, int io_priority, Cancellable ? cancellable, out size_t bytes_written) throws Error
public virtual async ssize_t write_async (uint8 []? buffer, int io_priority = DEFAULT , Cancellable ? cancellable = null ) throws IOError
public ssize_t write_bytes (Bytes bytes, Cancellable ? cancellable = null ) throws Error
public async ssize_t write_bytes_async (Bytes bytes, int io_priority = DEFAULT , Cancellable ? cancellable = null ) throws Error
public virtual bool writev (OutputVector [] vectors, out size_t bytes_written, Cancellable ? cancellable = null ) throws Error
public bool writev_all (OutputVector [] vectors, out size_t bytes_written, Cancellable ? cancellable = null ) throws Error
public async bool writev_all_async (OutputVector [] vectors, int io_priority = DEFAULT , Cancellable ? cancellable = null , out size_t bytes_written) throws Error
public virtual async bool writev_async (OutputVector [] vectors, int io_priority = DEFAULT , Cancellable ? cancellable = null , out size_t bytes_written) throws Error
Inherited Members:
All known members inherited from class GLib.Object