Pchp.Library.Streams.NativeStream.RawWrite C# (CSharp) Method

RawWrite() protected method

protected RawWrite ( byte buffer, int offset, int count ) : int
buffer byte
offset int
count int
return int
        protected override int RawWrite(byte[] buffer, int offset, int count)
        {
            long position = stream.CanSeek ? stream.Position : -1;
            try
            {
                stream.Write(buffer, offset, count);
                return stream.CanSeek ? unchecked((int)(stream.Position - position)) : count;
            }
            catch (NotSupportedException)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.wrapper_op_unsupported, "Write");
                return -1;
            }
            catch (IOException e)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_write_io_error, e.Message);
                return -1;
            }
            catch (System.Exception e)
            {
                PhpException.Throw(PhpError.Warning, ErrResources.stream_write_error, e.Message);
                return -1;
            }
        }