Struct xpcom::interfaces::nsIFileInputStream
[−]
[src]
#[repr(C)]pub struct nsIFileInputStream { /* fields omitted */ }
interface nsIFileInputStream : nsIInputStream
/**
* An input stream that allows you to read from a file.
*/
Methods
impl nsIFileInputStream
[src]
pub fn coerce<T: nsIFileInputStreamCoerce>(&self) -> &T
[src]
Cast this nsIFileInputStream
to one of its base interfaces.
impl nsIFileInputStream
[src]
pub const CLOSE_ON_EOF: i64
CLOSE_ON_EOF: i64 = 4
/**
* If this is set, the file will close automatically when the end of the
* file is reached.
*/
pub const REOPEN_ON_REWIND: i64
REOPEN_ON_REWIND: i64 = 8
/**
* If this is set, the file will be reopened whenever we reach the start of
* the file, either by doing a Seek(0, NS_SEEK_CUR), or by doing a relative
* seek that happen to reach the beginning of the file. If the file is
* already open and the seek occurs, it will happen naturally. (The file
* will only be reopened if it is closed for some reason.)
*/
pub const DEFER_OPEN: i64
DEFER_OPEN: i64 = 16
/**
* If this is set, the file will be opened (i.e., a call to
* PR_Open done) only when we do an actual operation on the stream,
* or more specifically, when one of the following is called:
* - Seek
* - Tell
* - SetEOF
* - Available
* - Read
* - ReadLine
*
* DEFER_OPEN is useful if we use the stream on a background
* thread, so that the opening and possible |stat|ing of the file
* happens there as well.
*
* @note Using this flag results in the file not being opened
* during the call to Init. This means that any errors that might
* happen when this flag is not set would happen during the
* first read. Also, the file is not locked when Init is called,
* so it might be deleted before we try to read from it.
*/
pub const SHARE_DELETE: i64
SHARE_DELETE: i64 = 32
/**
* This flag has no effect and is totally ignored on any platform except
* Windows since this is the default behavior on POSIX systems. On Windows
* if this flag is set then the stream is opened in a special mode that
* allows the OS to delete the file from disk just like POSIX.
*/
pub unsafe fn Init(
&self,
file: *const nsIFile,
ioFlags: int32_t,
perm: int32_t,
behaviorFlags: int32_t
) -> nsresult
[src]
&self,
file: *const nsIFile,
ioFlags: int32_t,
perm: int32_t,
behaviorFlags: int32_t
) -> nsresult
/**
* @param file file to read from
* @param ioFlags file open flags listed in prio.h (see
* PR_Open documentation) or -1 to open the
* file in default mode (PR_RDONLY).
* @param perm file mode bits listed in prio.h or -1 to
* use the default value (0)
* @param behaviorFlags flags specifying various behaviors of the class
* (see enumerations in the class)
*/
void init (in nsIFile file, in long ioFlags, in long perm, in long behaviorFlags);
Methods from Deref<Target = nsIInputStream>
pub fn coerce<T: nsIInputStreamCoerce>(&self) -> &T
[src]
Cast this nsIInputStream
to one of its base interfaces.
pub unsafe fn Close(&self) -> nsresult
[src]
/**
* nsIInputStream
*
* An interface describing a readable stream of data. An input stream may be
* "blocking" or "non-blocking" (see the IsNonBlocking method). A blocking
* input stream may suspend the calling thread in order to satisfy a call to
* Close, Available, Read, or ReadSegments. A non-blocking input stream, on
* the other hand, must not block the calling thread of execution.
*
* NOTE: blocking input streams are often read on a background thread to avoid
* locking up the main application thread. For this reason, it is generally
* the case that a blocking input stream should be implemented using thread-
* safe AddRef and Release.
*/
/**
* Close the stream. This method causes subsequent calls to Read and
* ReadSegments to return 0 bytes read to indicate end-of-file. Any
* subsequent calls to Available should throw NS_BASE_STREAM_CLOSED.
*/
void close ();
pub unsafe fn Available(&self, _retval: *mut uint64_t) -> nsresult
[src]
/**
* Determine number of bytes available in the stream. A non-blocking
* stream that does not yet have any data to read should return 0 bytes
* from this method (i.e., it must not throw the NS_BASE_STREAM_WOULD_BLOCK
* exception).
*
* In addition to the number of bytes available in the stream, this method
* also informs the caller of the current status of the stream. A stream
* that is closed will throw an exception when this method is called. That
* enables the caller to know the condition of the stream before attempting
* to read from it. If a stream is at end-of-file, but not closed, then
* this method returns 0 bytes available. (Note: some nsIInputStream
* implementations automatically close when eof is reached; some do not).
*
* @return number of bytes currently available in the stream.
*
* @throws NS_BASE_STREAM_CLOSED if the stream is closed normally.
* @throws <other-error> if the stream is closed due to some error
* condition
*/
unsigned long long available ();
pub unsafe fn Read(
&self,
aBuf: *mut u8,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
[src]
&self,
aBuf: *mut u8,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
/**
* Read data from the stream.
*
* @param aBuf the buffer into which the data is to be read
* @param aCount the maximum number of bytes to be read
*
* @return number of bytes read (may be less than aCount).
* @return 0 if reached end-of-file
*
* @throws NS_BASE_STREAM_WOULD_BLOCK if reading from the input stream would
* block the calling thread (non-blocking mode only)
* @throws <other-error> on failure
*
* NOTE: this method should not throw NS_BASE_STREAM_CLOSED.
*/
[noscript] unsigned long read (in charPtr aBuf, in unsigned long aCount);
pub unsafe fn IsNonBlocking(&self, _retval: *mut bool) -> nsresult
[src]
/**
* @return true if stream is non-blocking
*
* NOTE: reading from a blocking input stream will block the calling thread
* until at least one byte of data can be extracted from the stream.
*
* NOTE: a non-blocking input stream may implement nsIAsyncInputStream to
* provide consumers with a way to wait for the stream to have more data
* once its read method is unable to return any data without blocking.
*/
boolean isNonBlocking ();
Trait Implementations
impl XpCom for nsIFileInputStream
[src]
const IID: nsIID
IID: nsIID = nsID(3822414368, 51180, 4563, [140, 218, 0, 96, 176, 252, 20, 163])
fn query_interface<T: XpCom>(&self) -> Option<RefPtr<T>>
[src]
Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more
impl RefCounted for nsIFileInputStream
[src]
unsafe fn addref(&self)
[src]
Increment the reference count.
unsafe fn release(&self)
[src]
Decrement the reference count, potentially freeing backing memory.
impl Deref for nsIFileInputStream
[src]
type Target = nsIInputStream
The resulting type after dereferencing.
fn deref(&self) -> &nsIInputStream
[src]
Dereferences the value.