rv = fts->CreateTransport(fs, "load", nsnull, &fileTrans);
rv = fts->CreateTransport(fs, "load", &fileTrans);
TestAsyncWrite(const char* fileName, PRUint32 offset, PRInt32 length){    nsresult rv;    NS_WITH_SERVICE(nsIFileTransportService, fts, kFileTransportServiceCID, &rv);    if (NS_FAILED(rv)) return rv;    nsString outFile(fileName);    outFile += ".out";    nsFileSpec fs(outFile);    nsIChannel* fileTrans;    rv = fts->CreateTransport(fs, "load", nsnull, &fileTrans);    if (NS_FAILED(rv)) return rv;    MyListener* listener = new MyListener();    if (listener == nsnull)        return NS_ERROR_OUT_OF_MEMORY;    NS_ADDREF(listener);    rv = listener->Init(fs);    if (NS_FAILED(rv)) return rv;    nsFileSpec spec(fileName);    nsCOMPtr<nsISupports> in;    rv = NS_NewTypicalInputFileStream(getter_AddRefs(in), spec);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIInputStream> inStr = do_QueryInterface(in);    gDone = PR_FALSE;    rv = fileTrans->AsyncWrite(inStr, offset, length, nsnull, listener);    if (NS_FAILED(rv)) return rv;    while (!gDone) {        PLEvent* event;        rv = gEventQ->GetEvent(&event);        if (NS_FAILED(rv)) return rv;        rv = gEventQ->HandleEvent(event);        if (NS_FAILED(rv)) return rv;    }    NS_RELEASE(listener);    NS_RELEASE(fileTrans);    return NS_OK;}