protected override int RawRead(byte[] buffer, int offset, int count)
{
try
{
int read = stream.Read(buffer, offset, count);
if (read == 0) reportEof = true;
return read;
}
catch (NotSupportedException)
{
PhpException.Throw(PhpError.Warning, ErrResources.wrapper_op_unsupported, "Read");
return -1;
}
catch (IOException e)
{
PhpException.Throw(PhpError.Warning, ErrResources.stream_read_io_error, e.Message);
return -1;
}
catch (System.Exception e)
{
// For example WebException (timeout)
PhpException.Throw(PhpError.Warning, ErrResources.stream_read_error, e.Message);
return -1;
}
}