Closed
Bug 289400
Opened 20 years ago
Closed 9 years ago
nsIFileOutputStream.writeFrom() is not implemented
Categories
(Core :: Networking: File, defect)
Core
Networking: File
Tracking
()
RESOLVED
INVALID
People
(Reporter: surkov, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; ru-RU; rv:1.7.5) Gecko/20041108 Firefox/1.0 (ax) Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b) Gecko/20050217 When I try to call writeFrom() method of nsIFileOutputStream interface then I get exception: Error: uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIFileOutputStream.writeFrom]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" data: no] Reproducible: Always Steps to Reproduce:
Updated•20 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 1•20 years ago
|
||
this is intentional http://lxr.mozilla.org/seamonkey/source/netwerk/base/src/nsFileStreams.cpp#461 466 // File streams intentionally do not support this method. 467 // If you need something like this, then you should wrap 468 // the file stream using nsIBufferedOutputStream but I forgot the reason, I'll let darin comment before marking this invalid
OS: Windows 2000 → All
Hardware: PC → All
Comment 2•20 years ago
|
||
Usually, if your stream doesn't implement WriteSegments, then it doesn't
implement WriteFrom. To implement WriteFrom for nsFileOutputStream, we'd need
to create a temporary buffer, read from the source input stream into that
temporary buffer, and then PR_Write the buffer to the file. This is no more
efficient than if the caller used the nsFileOutputStream::Write method directly.
Additionally, WriteFrom could check to see if the input stream supported
ReadSegments, and if so it could use that to avoid the intermediate buffer copy.
But, it cannot rely on the input stream supporting ReadSegments. So, the only
reason for not implementing WriteFrom is for consistency with other unbuffered
output streams.
I think it might be nice for consumers if we exposed buffered file streams that
do this object wrapping automatically.
@mozilla.org/network/buffered-file-input-stream;1
@mozilla.org/network/buffered-file-output-stream;1
These could just initialize a buffered stream using the default necko buffer
parameters (segment size and max count), and wrap it around the apprioriate file
stream. However, the challenge with that is that we'd need a way to still
expose the nsIFile{In,Out}putStream interfaces via QI.
Updated•18 years ago
|
Assignee: darin → nobody
QA Contact: benc → networking.file
Updated•9 years ago
|
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•