public function __construct($file)
{
if (is_string($file)) {
$this->fp = \fopen($file, 'wb');
$this->closeAfter = true;
$this->pos = 0;
$this->stat = \fstat($this->fp);
} elseif (is_resource($file)) {
$this->fp = $file;
$this->pos = \ftell($this->fp);
$this->stat = \fstat($this->fp);
} else {
throw new CryptoException\InvalidType('Argument 1: Expected a filename or resource');
}
}