Struct xpcom::interfaces::nsIBinaryOutputStream [] [src]

#[repr(C)]
pub struct nsIBinaryOutputStream { /* fields omitted */ }

interface nsIBinaryOutputStream : nsIOutputStream

/**
 * This interface allows writing of primitive data types (integers,
 * floating-point values, booleans, etc.) to a stream in a binary, untagged,
 * fixed-endianness format.  This might be used, for example, to implement
 * network protocols or to produce architecture-neutral binary disk files,
 * i.e. ones that can be read and written by both big-endian and little-endian
 * platforms.  Output is written in big-endian order (high-order byte first),
 * as this is traditional network order.
 *
 * @See nsIBinaryInputStream
 */

Methods

impl nsIBinaryOutputStream
[src]

[src]

Cast this nsIBinaryOutputStream to one of its base interfaces.

impl nsIBinaryOutputStream
[src]

[src]

void setOutputStream (in nsIOutputStream aOutputStream);

[src]

/**
     * Write a boolean as an 8-bit char to the stream.
     */

void writeBoolean (in boolean aBoolean);

[src]

void write8 (in uint8_t aByte);

[src]

void write16 (in uint16_t a16);

[src]

void write32 (in uint32_t a32);

[src]

void write64 (in uint64_t a64);

[src]

void writeFloat (in float aFloat);

[src]

void writeDouble (in double aDouble);

[src]

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

void writeStringZ (in string aString);

[src]

/**
     * Write a 16-bit pascal style string to the stream.
     * 32-bit length field, followed by length PRUnichars.
     */

void writeWStringZ (in wstring aString);

[src]

/**
     * Write an 8-bit pascal style string (UTF8-encoded) to the stream.
     * 32-bit length field, followed by length 8-bit chars.
     */

void writeUtf8Z (in wstring aString);

[src]

/**
     * Write an opaque byte array to the stream.
     */

void writeBytes ([size_is (aLength)] in string aString, in uint32_t aLength);

[src]

/**
     * Write an opaque byte array to the stream.
     */

void writeByteArray ([array, size_is (aLength)] in uint8_t aBytes, in uint32_t aLength);

Methods from Deref<Target = nsIOutputStream>

[src]

Cast this nsIOutputStream to one of its base interfaces.

[src]

/**
 * nsIOutputStream
 *
 * An interface describing a writable stream of data.  An output stream may be
 * "blocking" or "non-blocking" (see the IsNonBlocking method).  A blocking
 * output stream may suspend the calling thread in order to satisfy a call to
 * Close, Flush, Write, WriteFrom, or WriteSegments.  A non-blocking output
 * stream, on the other hand, must not block the calling thread of execution.
 *
 * NOTE: blocking output streams are often written to on a background thread to
 * avoid locking up the main application thread.  For this reason, it is
 * generally the case that a blocking output stream should be implemented using
 * thread- safe AddRef and Release.
 */
/**
     * Close the stream. Forces the output stream to flush any buffered data.
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
     *   the calling thread (non-blocking mode only)
     */

void close ();

[src]

/**
     * Flush the stream.
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if unable to flush without blocking
     *   the calling thread (non-blocking mode only)
     */

void flush ();

[src]

/**
     * Write data into the stream.
     *
     * @param aBuf the buffer containing the data to be written
     * @param aCount the maximum number of bytes to be written
     *
     * @return number of bytes written (may be less than aCount)
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
     *   block the calling thread (non-blocking mode only)
     * @throws <other-error> on failure
     */

unsigned long write (in string aBuf, in unsigned long aCount);

[src]

/**
     * Writes data into the stream from an input stream.
     *
     * @param aFromStream the stream containing the data to be written
     * @param aCount the maximum number of bytes to be written
     *
     * @return number of bytes written (may be less than aCount)
     *
     * @throws NS_BASE_STREAM_WOULD_BLOCK if writing to the output stream would
     *    block the calling thread (non-blocking mode only). This failure
     *    means no bytes were transferred.
     * @throws <other-error> on failure
     *
     * NOTE: This method is defined by this interface in order to allow the
     * output stream to efficiently copy the data from the input stream into
     * its internal buffer (if any). If this method was provided as an external
     * facility, a separate char* buffer would need to be used in order to call
     * the output stream's other Write method.
     */

unsigned long writeFrom (in nsIInputStream aFromStream, in unsigned long aCount);

[src]

/**
     * @return true if stream is non-blocking
     *
     * NOTE: writing to a blocking output stream will block the calling thread
     * until all given data can be consumed by the stream.
     *
     * NOTE: a non-blocking output stream may implement nsIAsyncOutputStream to
     * provide consumers with a way to wait for the stream to accept more data
     * once its write method is unable to accept any data without blocking.
     */

boolean isNonBlocking ();

Trait Implementations

impl XpCom for nsIBinaryOutputStream
[src]

IID: nsIID = nsID(542041616, 34661, 4563, [144, 207, 0, 64, 5, 106, 144, 110])

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

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsIBinaryOutputStream
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.