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]

[src]

Cast this nsIBinaryInputStream to one of its base interfaces.

impl nsIBinaryInputStream
[src]

[src]

void setInputStream (in nsIInputStream aInputStream);

[src]

/**
     * Read 8-bits from the stream.
     *
     * @return that byte to be treated as a boolean.
     */

boolean readBoolean ();

[src]

uint8_t read8 ();

[src]

uint16_t read16 ();

[src]

uint32_t read32 ();

[src]

uint64_t read64 ();

[src]

float readFloat ();

[src]

double readDouble ();

[src]

/**
     * Read an 8-bit pascal style string from the stream.
     * 32-bit length field, followed by length 8-bit chars.
     */

ACString readCString ();

[src]

/**
     * Read an 16-bit pascal style string from the stream.
     * 32-bit length field, followed by length PRUnichars.
     */

AString readString ();

[src]

/**
     * 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);

[src]

/**
     * 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>

[src]

Cast this nsIInputStream to one of its base interfaces.

[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 ();

[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 ();

[src]

/**
     * 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);

[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]

IID: nsIID = nsID(2308670059, 11955, 18076, [139, 49, 76, 41, 245, 211, 65, 166])

[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]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIBinaryInputStream
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.