rv = NS_NewLocalFile(filename, getter_AddRefs(fs));
rv = NS_NewLocalFile(filename, PR_FALSE, getter_AddRefs(fs));
TestSyncWrite(char* filename, PRUint32 startPosition, PRInt32 length){    nsresult rv;    nsCOMPtr<nsIOutputStream> outStream ;    RandomStream *randomStream;    char buf[500];        NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv) ;    if (NS_FAILED(rv)) return rv ;      nsCOMPtr<nsILocalFile> fs;    rv = NS_NewLocalFile(filename, getter_AddRefs(fs));    if (NS_FAILED(rv)) return rv ;    nsCOMPtr<nsIChannel> transport;    rv = fts->CreateTransport(fs, PR_RDWR | PR_CREATE_FILE, 0664,                              getter_AddRefs(transport)) ;    if (NS_FAILED(rv)) return rv ;     rv = transport->SetTransferOffset(startPosition);    if (NS_FAILED(rv)) return rv;    rv = transport->OpenOutputStream(getter_AddRefs(outStream)) ;    if (NS_FAILED(rv)) return rv;        PRIntervalTime startTime = PR_IntervalNow();    randomStream = new RandomStream(PL_HashString(filename));    int remaining = length;    while (remaining) {        PRUint32 numWritten;        int amount = PR_MIN(sizeof buf, remaining);        randomStream->Read(buf, amount);        rv = outStream->Write(buf, amount, &numWritten);        NS_ASSERTION(NS_SUCCEEDED(rv), " ");        NS_ASSERTION(numWritten == (PRUint32)amount, "Write() bug?");                remaining -= amount;    }    outStream->Close();    gTotalBytesWritten += length;    PRIntervalTime endTime = PR_IntervalNow();    gDuration += (endTime - startTime);    delete randomStream;    return NS_OK;}