BufferedOutputStream

Buffered output stream implements gio.FilterOutputStream and provides for buffered writes.

By default, gio.BufferedOutputStream's buffer size is set at 4 kilobytes.

To create a buffered output stream, use BufferedOutputStream.new, or BufferedOutputStream.newSized to specify the buffer's size at construction.

To get the size of a buffer within a buffered input stream, use BufferedOutputStream.getBufferSize. To change the size of a buffered output stream's buffer, use BufferedOutputStream.setBufferSize. Note that the buffer's size cannot be reduced below the size of the data within the buffer.

Constructors

this
this(GBufferedOutputStream* gBufferedOutputStream, bool ownedRef = false)

Sets our main struct and passes it to the parent class.

this
this(OutputStream baseStream)

Creates a new buffered output stream for a base stream.

this
this(OutputStream baseStream, size_t size)

Creates a new buffered output stream with a given buffer size.

Members

Functions

getAutoGrow
bool getAutoGrow()

Checks if the buffer automatically grows as data is added.

getBufferSize
size_t getBufferSize()

Gets the size of the buffer in the stream.

getBufferedOutputStreamStruct
GBufferedOutputStream* getBufferedOutputStreamStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

setAutoGrow
void setAutoGrow(bool autoGrow)

Sets whether or not the stream's buffer should automatically grow. If auto_grow is true, then each write will just make the buffer larger, and you must manually flush the buffer to actually write out the data to the underlying stream.

setBufferSize
void setBufferSize(size_t size)

Sets the size of the internal buffer to size.

Static functions

getType
GType getType()

Variables

gBufferedOutputStream
GBufferedOutputStream* gBufferedOutputStream;

the main Gtk struct

Inherited Members

From FilterOutputStream

gFilterOutputStream
GFilterOutputStream* gFilterOutputStream;

the main Gtk struct

getFilterOutputStreamStruct
GFilterOutputStream* getFilterOutputStreamStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getBaseStream
OutputStream getBaseStream()

Gets the base stream for the filter stream.

getCloseBaseStream
bool getCloseBaseStream()

Returns whether the base stream will be closed when stream is closed.

setCloseBaseStream
void setCloseBaseStream(bool closeBase)

Sets whether the base stream will be closed when stream is closed.

From SeekableIF

getSeekableStruct
GSeekable* getSeekableStruct(bool transferOwnership = false)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
canSeek
bool canSeek()

Tests if the stream supports the GSeekableIface

canTruncate
bool canTruncate()

Tests if the length of the stream can be adjusted with g_seekable_truncate().

seek
bool seek(long offset, GSeekType type, Cancellable cancellable)

Seeks in the stream by the given offset, modified by type.

tell
long tell()

Tells the current position within the stream.

truncate
bool truncate(long offset, Cancellable cancellable)

Sets the length of the stream to offset. If the stream was previously larger than offset, the extra data is discarded. If the stream was previouly shorter than offset, it is extended with NUL ('\0') bytes.

Meta