public function equals($obj)
    {
        if ($obj instanceof QtiFile) {
            if ($this->getFilename() !== $obj->getFilename()) {
                return false;
            } elseif ($this->getMimeType() !== $obj->getMimeType()) {
                return false;
            } else {
                // We have to check the content of the file.
                $myStream = $this->getStream();
                $objStream = $obj->getStream();

                while (feof($myStream) === false && feof($objStream) === false) {
                    $myChunk = fread($myStream, self::CHUNK_SIZE);
                    $objChjunk = fread($objStream, self::CHUNK_SIZE);

                    if ($myChunk !== $objChjunk) {
                        @fclose($myStream);
                        @fclose($objStream);

                        return false;
                    }
                }

                @fclose($myStream);
                @fclose($objStream);

                return true;
            }
        }

        return false;
    }