Open Bug 1388773 Opened 7 years ago Updated 2 years ago

add an nsIFixedLengthInputStream

Categories

(Core :: XPCOM, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: bkelly, Unassigned)

References

(Blocks 1 open bug)

Details

We have a number of places that try to use nsIInputStream::Available() to determine the total length of the stream. These are very fragile because they have to ensure that the stream is fully available before its called. For anything like a pipe you will end up getting a partial size instead. We could, however, provide a better mechanism by exposing an explicit interface for "fixed length streams with a known total size". Something like: interface nsIFixedLengthInputStream { // True when all the data is known. For file streams it will always // be true. For streams like storage streams it may be false and become // true. readonly attribute bool complete; unsigned long long totalSize(); // Maybe add a callback mechanism to be notified when the stream // is "complete". };
Blocks: 1388774
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.