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 private import gobject.ObjectG; 61 62 63 private import gio.OutputStream; 64 65 66 67 private import gio.FilterOutputStream; 68 69 /** 70 * Buffered output stream implements GFilterOutputStream and provides 71 * for buffered writes. 72 * 73 * By default, GBufferedOutputStream's buffer size is set at 4 kilobytes. 74 * 75 * To create a buffered output stream, use g_buffered_output_stream_new(), 76 * or g_buffered_output_stream_new_sized() to specify the buffer's size 77 * at construction. 78 * 79 * To get the size of a buffer within a buffered input stream, use 80 * g_buffered_output_stream_get_buffer_size(). To change the size of a 81 * buffered output stream's buffer, use 82 * g_buffered_output_stream_set_buffer_size(). Note that the buffer's 83 * size cannot be reduced below the size of the data within the buffer. 84 */ 85 public class BufferedOutputStream : FilterOutputStream 86 { 87 88 /** the main Gtk struct */ 89 protected GBufferedOutputStream* gBufferedOutputStream; 90 91 92 public GBufferedOutputStream* getBufferedOutputStreamStruct() 93 { 94 return gBufferedOutputStream; 95 } 96 97 98 /** the main Gtk struct as a void* */ 99 protected override void* getStruct() 100 { 101 return cast(void*)gBufferedOutputStream; 102 } 103 104 /** 105 * Sets our main struct and passes it to the parent class 106 */ 107 public this (GBufferedOutputStream* gBufferedOutputStream) 108 { 109 super(cast(GFilterOutputStream*)gBufferedOutputStream); 110 this.gBufferedOutputStream = gBufferedOutputStream; 111 } 112 113 protected override void setStruct(GObject* obj) 114 { 115 super.setStruct(obj); 116 gBufferedOutputStream = cast(GBufferedOutputStream*)obj; 117 } 118 119 /** 120 */ 121 122 /** 123 * Creates a new buffered output stream for a base stream. 124 * Params: 125 * baseStream = a GOutputStream. 126 * Throws: ConstructionException GTK+ fails to create the object. 127 */ 128 public this (OutputStream baseStream) 129 { 130 // GOutputStream * g_buffered_output_stream_new (GOutputStream *base_stream); 131 auto p = g_buffered_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct()); 132 if(p is null) 133 { 134 throw new ConstructionException("null returned by g_buffered_output_stream_new((baseStream is null) ? null : baseStream.getOutputStreamStruct())"); 135 } 136 this(cast(GBufferedOutputStream*) p); 137 } 138 139 /** 140 * Creates a new buffered output stream with a given buffer size. 141 * Params: 142 * baseStream = a GOutputStream. 143 * size = a gsize. 144 * Throws: ConstructionException GTK+ fails to create the object. 145 */ 146 public this (OutputStream baseStream, gsize size) 147 { 148 // GOutputStream * g_buffered_output_stream_new_sized (GOutputStream *base_stream, gsize size); 149 auto p = g_buffered_output_stream_new_sized((baseStream is null) ? null : baseStream.getOutputStreamStruct(), size); 150 if(p is null) 151 { 152 throw new ConstructionException("null returned by g_buffered_output_stream_new_sized((baseStream is null) ? null : baseStream.getOutputStreamStruct(), size)"); 153 } 154 this(cast(GBufferedOutputStream*) p); 155 } 156 157 /** 158 * Gets the size of the buffer in the stream. 159 * Returns: the current size of the buffer. 160 */ 161 public gsize getBufferSize() 162 { 163 // gsize g_buffered_output_stream_get_buffer_size (GBufferedOutputStream *stream); 164 return g_buffered_output_stream_get_buffer_size(gBufferedOutputStream); 165 } 166 167 /** 168 * Sets the size of the internal buffer to size. 169 * Params: 170 * size = a gsize. 171 */ 172 public void setBufferSize(gsize size) 173 { 174 // void g_buffered_output_stream_set_buffer_size (GBufferedOutputStream *stream, gsize size); 175 g_buffered_output_stream_set_buffer_size(gBufferedOutputStream, size); 176 } 177 178 /** 179 * Checks if the buffer automatically grows as data is added. 180 * Returns: TRUE if the stream's buffer automatically grows, FALSE otherwise. 181 */ 182 public int getAutoGrow() 183 { 184 // gboolean g_buffered_output_stream_get_auto_grow (GBufferedOutputStream *stream); 185 return g_buffered_output_stream_get_auto_grow(gBufferedOutputStream); 186 } 187 188 /** 189 * Sets whether or not the stream's buffer should automatically grow. 190 * If auto_grow is true, then each write will just make the buffer 191 * larger, and you must manually flush the buffer to actually write out 192 * the data to the underlying stream. 193 * Params: 194 * autoGrow = a gboolean. 195 */ 196 public void setAutoGrow(int autoGrow) 197 { 198 // void g_buffered_output_stream_set_auto_grow (GBufferedOutputStream *stream, gboolean auto_grow); 199 g_buffered_output_stream_set_auto_grow(gBufferedOutputStream, autoGrow); 200 } 201 }