if (!mStreamIO)  return NS_ERROR_NOT_AVAILABLE;
if (mClosed)  return NS_ERROR_NOT_AVAILABLE;
nsDiskCacheInputStream::Read(char * buffer, PRUint32 count, PRUint32 * bytesRead){    if (!mStreamIO)  return NS_ERROR_NOT_AVAILABLE;        *bytesRead = 0;    if (mPos == mStreamEnd)  return NS_OK;    if (mPos > mStreamEnd)   return NS_ERROR_UNEXPECTED;        if (mFD) {        // just read from file        PRInt32  result = PR_Read(mFD, buffer, count);        if (result < 0)  return  NS_ErrorAccordingToNSPR();                mPos += (PRUint32)result;        *bytesRead = (PRUint32)result;            } else if (mBuffer) {        // read data from mBuffer        if (count > mStreamEnd - mPos)            count = mStreamEnd - mPos;            memcpy(buffer, mBuffer + mPos, count);        mPos += count;        *bytesRead = count;    } else {        // no data source for input stream    }    return NS_OK;}