From f6009bbde14a3f26d4b86289863283c2eb7e71f1 Mon Sep 17 00:00:00 2001 From: Gabriel Burt Date: Mon, 18 Jan 2010 09:36:53 +0100 Subject: [PATCH] gio: Implement GioStream.SetLength --- gio/GioStream.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gio/GioStream.cs b/gio/GioStream.cs index 259d9d5f3..631549244 100644 --- a/gio/GioStream.cs +++ b/gio/GioStream.cs @@ -218,9 +218,16 @@ public override void SetLength (long value) { if (!CanSeek || !CanWrite) throw new NotSupportedException ("This stream doesn't support seeking"); + + var seekable = stream as Seekable; + + if (!seekable.CanTruncate ()) + throw new NotSupportedException ("This stream doesn't support truncating"); + if (is_disposed) throw new ObjectDisposedException ("The stream is closed"); - throw new NotImplementedException (); + + seekable.Truncate (value, null); } public override void Close ()