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;
}
}