Struct xpcom::interfaces::nsIBinaryInputStream
[−]
[src]
#[repr(C)]pub struct nsIBinaryInputStream { /* fields omitted */ }
interface nsIBinaryInputStream : nsIInputStream
/**
* This interface allows consumption of primitive data types from a "binary
* stream" containing untagged, big-endian binary data, i.e. as produced by an
* implementation of nsIBinaryOutputStream. This might be used, for example,
* to implement network protocols or to read from architecture-neutral disk
* files, i.e. ones that can be read and written by both big-endian and
* little-endian platforms.
*
* @See nsIBinaryOutputStream
*/
Methods
impl nsIBinaryInputStream
[src]
pub fn coerce<T: nsIBinaryInputStreamCoerce>(&self) -> &T
[src]
Cast this nsIBinaryInputStream
to one of its base interfaces.
impl nsIBinaryInputStream
[src]
pub unsafe fn SetInputStream(
&self,
aInputStream: *const nsIInputStream
) -> nsresult
[src]
&self,
aInputStream: *const nsIInputStream
) -> nsresult
void setInputStream (in nsIInputStream aInputStream);
pub unsafe fn ReadBoolean(&self, _retval: *mut bool) -> nsresult
[src]
/**
* Read 8-bits from the stream.
*
* @return that byte to be treated as a boolean.
*/
boolean readBoolean ();
pub unsafe fn Read8(&self, _retval: *mut uint8_t) -> nsresult
[src]
uint8_t read8 ();
pub unsafe fn Read16(&self, _retval: *mut uint16_t) -> nsresult
[src]
uint16_t read16 ();
pub unsafe fn Read32(&self, _retval: *mut uint32_t) -> nsresult
[src]
uint32_t read32 ();
pub unsafe fn Read64(&self, _retval: *mut uint64_t) -> nsresult
[src]
uint64_t read64 ();
pub unsafe fn ReadFloat(&self, _retval: *mut c_float) -> nsresult
[src]
float readFloat ();
pub unsafe fn ReadDouble(&self, _retval: *mut c_double) -> nsresult
[src]
double readDouble ();
pub unsafe fn ReadCString(&self, _retval: &mut nsACString) -> nsresult
[src]
/**
* Read an 8-bit pascal style string from the stream.
* 32-bit length field, followed by length 8-bit chars.
*/
ACString readCString ();
pub unsafe fn ReadString(&self, _retval: &mut nsAString) -> nsresult
[src]
/**
* Read an 16-bit pascal style string from the stream.
* 32-bit length field, followed by length PRUnichars.
*/
AString readString ();
pub unsafe fn ReadBytes(
&self,
aLength: uint32_t,
aString: *mut *const c_char
) -> nsresult
[src]
&self,
aLength: uint32_t,
aString: *mut *const c_char
) -> nsresult
/**
* Read an opaque byte array from the stream.
*
* @param aLength the number of bytes that must be read.
*
* @throws NS_ERROR_FAILURE if it can't read aLength bytes
*/
void readBytes (in uint32_t aLength, [size_is (aLength), retval] out string aString);
pub unsafe fn ReadByteArray(
&self,
aLength: uint32_t,
aBytes: *mut *mut uint8_t
) -> nsresult
[src]
&self,
aLength: uint32_t,
aBytes: *mut *mut uint8_t
) -> nsresult
/**
* Read an opaque byte array from the stream, storing the results
* as an array of PRUint8s.
*
* @param aLength the number of bytes that must be read.
*
* @throws NS_ERROR_FAILURE if it can't read aLength bytes
*/
void readByteArray (in uint32_t aLength, [array, size_is (aLength), retval] out uint8_t aBytes);
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 nsIBinaryInputStream
[src]
const IID: nsIID
IID: nsIID = nsID(2308670059, 11955, 18076, [139, 49, 76, 41, 245, 211, 65, 166])
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 nsIBinaryInputStream
[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 nsIBinaryInputStream
[src]
type Target = nsIInputStream
The resulting type after dereferencing.
fn deref(&self) -> &nsIInputStream
[src]
Dereferences the value.