| 1 |
/* |
|---|
| 2 |
* This file is part of gtkD. |
|---|
| 3 |
* |
|---|
| 4 |
* gtkD is free software; you can redistribute it and/or modify |
|---|
| 5 |
* it under the terms of the GNU Lesser General Public License |
|---|
| 6 |
* as published by the Free Software Foundation; either version 3 |
|---|
| 7 |
* of the License, or (at your option) any later version, with |
|---|
| 8 |
* some exceptions, please read the COPYING file. |
|---|
| 9 |
* |
|---|
| 10 |
* gtkD is distributed in the hope that it will be useful, |
|---|
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 |
* GNU Lesser General Public License for more details. |
|---|
| 14 |
* |
|---|
| 15 |
* You should have received a copy of the GNU Lesser General Public License |
|---|
| 16 |
* along with gtkD; if not, write to the Free Software |
|---|
| 17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA |
|---|
| 18 |
*/ |
|---|
| 19 |
|
|---|
| 20 |
// generated automatically - do not change |
|---|
| 21 |
// find conversion definition on APILookup.txt |
|---|
| 22 |
// implement new conversion functionalities on the wrap.utils pakage |
|---|
| 23 |
|
|---|
| 24 |
/* |
|---|
| 25 |
* Conversion parameters: |
|---|
| 26 |
* inFile = GBufferedOutputStream.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = BufferedOutputStream |
|---|
| 29 |
* strct = GBufferedOutputStream |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct=GOutputStream |
|---|
| 32 |
* clss = BufferedOutputStream |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: No |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* prefixes: |
|---|
| 40 |
* - g_buffered_output_stream_ |
|---|
| 41 |
* omit structs: |
|---|
| 42 |
* omit prefixes: |
|---|
| 43 |
* omit code: |
|---|
| 44 |
* omit signals: |
|---|
| 45 |
* imports: |
|---|
| 46 |
* - gio.OutputStream |
|---|
| 47 |
* structWrap: |
|---|
| 48 |
* - GOutputStream* -> OutputStream |
|---|
| 49 |
* module aliases: |
|---|
| 50 |
* local aliases: |
|---|
| 51 |
* overrides: |
|---|
| 52 |
*/ |
|---|
| 53 |
|
|---|
| 54 |
module gio.BufferedOutputStream; |
|---|
| 55 |
|
|---|
| 56 |
public import gtkc.giotypes; |
|---|
| 57 |
|
|---|
| 58 |
private import gtkc.gio; |
|---|
| 59 |
private import glib.ConstructionException; |
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
private import gio.OutputStream; |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
private import gio.FilterOutputStream; |
|---|
| 67 |
|
|---|
| 68 |
/** |
|---|
| 69 |
* Description |
|---|
| 70 |
* Buffered output stream implements GFilterOutputStream and provides |
|---|
| 71 |
* for buffered writes. |
|---|
| 72 |
* By default, GBufferedOutputStream's buffer size is set at 4 kilobytes. |
|---|
| 73 |
* To create a buffered output stream, use g_buffered_output_stream_new(), |
|---|
| 74 |
* or g_buffered_output_stream_new_sized() to specify the buffer's size |
|---|
| 75 |
* at construction. |
|---|
| 76 |
* To get the size of a buffer within a buffered input stream, use |
|---|
| 77 |
* g_buffered_output_stream_get_buffer_size(). To change the size of a |
|---|
| 78 |
* buffered output stream's buffer, use |
|---|
| 79 |
* g_buffered_output_stream_set_buffer_size(). Note that the buffer's |
|---|
| 80 |
* size cannot be reduced below the size of the data within the buffer. |
|---|
| 81 |
*/ |
|---|
| 82 |
public class BufferedOutputStream : FilterOutputStream |
|---|
| 83 |
{ |
|---|
| 84 |
|
|---|
| 85 |
/** the main Gtk struct */ |
|---|
| 86 |
protected GBufferedOutputStream* gBufferedOutputStream; |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
public GBufferedOutputStream* getBufferedOutputStreamStruct() |
|---|
| 90 |
{ |
|---|
| 91 |
return gBufferedOutputStream; |
|---|
| 92 |
} |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
/** the main Gtk struct as a void* */ |
|---|
| 96 |
protected override void* getStruct() |
|---|
| 97 |
{ |
|---|
| 98 |
return cast(void*)gBufferedOutputStream; |
|---|
| 99 |
} |
|---|
| 100 |
|
|---|
| 101 |
/** |
|---|
| 102 |
* Sets our main struct and passes it to the parent class |
|---|
| 103 |
*/ |
|---|
| 104 |
public this (GBufferedOutputStream* gBufferedOutputStream) |
|---|
| 105 |
{ |
|---|
| 106 |
if(gBufferedOutputStream is null) |
|---|
| 107 |
{ |
|---|
| 108 |
this = null; |
|---|
| 109 |
return; |
|---|
| 110 |
} |
|---|
| 111 |
//Check if there already is a D object for this gtk struct |
|---|
| 112 |
void* ptr = getDObject(cast(GObject*)gBufferedOutputStream); |
|---|
| 113 |
if( ptr !is null ) |
|---|
| 114 |
{ |
|---|
| 115 |
this = cast(BufferedOutputStream)ptr; |
|---|
| 116 |
return; |
|---|
| 117 |
} |
|---|
| 118 |
super(cast(GFilterOutputStream*)gBufferedOutputStream); |
|---|
| 119 |
this.gBufferedOutputStream = gBufferedOutputStream; |
|---|
| 120 |
} |
|---|
| 121 |
|
|---|
| 122 |
protected override void setStruct(GObject* obj) |
|---|
| 123 |
{ |
|---|
| 124 |
super.setStruct(obj); |
|---|
| 125 |
gBufferedOutputStream = cast(GBufferedOutputStream*)obj; |
|---|
| 126 |
} |
|---|
| 127 |
|
|---|
| 128 |
/** |
|---|
| 129 |
*/ |
|---|
| 130 |
|
|---|
| 131 |
/** |
|---|
| 132 |
* Creates a new buffered output stream for a base stream. |
|---|
| 133 |
* Params: |
|---|
| 134 |
* baseStream = a GOutputStream. |
|---|
| 135 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 136 |
*/ |
|---|
| 137 |
public this (OutputStream baseStream) |
|---|
| 138 |
{ |
|---|
| 139 |
// GOutputStream * g_buffered_output_stream_new (GOutputStream *base_stream); |
|---|
| 140 |
auto p = g_buffered_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct()); |
|---|
| 141 |
if(p is null) |
|---|
| 142 |
{ |
|---|
| 143 |
throw new ConstructionException("null returned by g_buffered_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct())"); |
|---|
| 144 |
} |
|---|
| 145 |
this(cast(GBufferedOutputStream*) p); |
|---|
| 146 |
} |
|---|
| 147 |
|
|---|
| 148 |
/** |
|---|
| 149 |
* Creates a new buffered output stream with a given buffer size. |
|---|
| 150 |
* Params: |
|---|
| 151 |
* baseStream = a GOutputStream. |
|---|
| 152 |
* size = a gsize. |
|---|
| 153 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 154 |
*/ |
|---|
| 155 |
public this (OutputStream baseStream, gsize size) |
|---|
| 156 |
{ |
|---|
| 157 |
// GOutputStream * g_buffered_output_stream_new_sized (GOutputStream *base_stream, gsize size); |
|---|
| 158 |
auto p = g_buffered_output_stream_new_sized((baseStream is null) ? null : baseStream.getOutputStreamStruct(), size); |
|---|
| 159 |
if(p is null) |
|---|
| 160 |
{ |
|---|
| 161 |
throw new ConstructionException("null returned by g_buffered_output_stream_new_sized((baseStream is null) ? null : baseStream.getOutputStreamStruct(), size)"); |
|---|
| 162 |
} |
|---|
| 163 |
this(cast(GBufferedOutputStream*) p); |
|---|
| 164 |
} |
|---|
| 165 |
|
|---|
| 166 |
/** |
|---|
| 167 |
* Gets the size of the buffer in the stream. |
|---|
| 168 |
* Returns: the current size of the buffer. |
|---|
| 169 |
*/ |
|---|
| 170 |
public gsize getBufferSize() |
|---|
| 171 |
{ |
|---|
| 172 |
// gsize g_buffered_output_stream_get_buffer_size (GBufferedOutputStream *stream); |
|---|
| 173 |
return g_buffered_output_stream_get_buffer_size(gBufferedOutputStream); |
|---|
| 174 |
} |
|---|
| 175 |
|
|---|
| 176 |
/** |
|---|
| 177 |
* Sets the size of the internal buffer to size. |
|---|
| 178 |
* Params: |
|---|
| 179 |
* size = a gsize. |
|---|
| 180 |
*/ |
|---|
| 181 |
public void setBufferSize(gsize size) |
|---|
| 182 |
{ |
|---|
| 183 |
// void g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream, gsize size); |
|---|
| 184 |
g_buffered_output_stream_set_buffer_size(gBufferedOutputStream, size); |
|---|
| 185 |
} |
|---|
| 186 |
|
|---|
| 187 |
/** |
|---|
| 188 |
* Checks if the buffer automatically grows as data is added. |
|---|
| 189 |
* Returns: TRUE if the stream's buffer automatically grows, FALSE otherwise. |
|---|
| 190 |
*/ |
|---|
| 191 |
public int getAutoGrow() |
|---|
| 192 |
{ |
|---|
| 193 |
// gboolean g_buffered_output_stream_get_auto_grow (GBufferedOutputStream *stream); |
|---|
| 194 |
return g_buffered_output_stream_get_auto_grow(gBufferedOutputStream); |
|---|
| 195 |
} |
|---|
| 196 |
|
|---|
| 197 |
/** |
|---|
| 198 |
* Sets whether or not the stream's buffer should automatically grow. |
|---|
| 199 |
* If auto_grow is true, then each write will just make the buffer |
|---|
| 200 |
* larger, and you must manually flush the buffer to actually write out |
|---|
| 201 |
* the data to the underlying stream. |
|---|
| 202 |
* Params: |
|---|
| 203 |
* autoGrow = a gboolean. |
|---|
| 204 |
*/ |
|---|
| 205 |
public void setAutoGrow(int autoGrow) |
|---|
| 206 |
{ |
|---|
| 207 |
// void g_buffered_output_stream_set_auto_grow (GBufferedOutputStream *stream, gboolean auto_grow); |
|---|
| 208 |
g_buffered_output_stream_set_auto_grow(gBufferedOutputStream, autoGrow); |
|---|
| 209 |
} |
|---|
| 210 |
} |
|---|