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]
pub fn coerce<T: nsIBinaryOutputStreamCoerce>(&self) -> &T
[src]
Cast this nsIBinaryOutputStream
to one of its base interfaces.
impl nsIBinaryOutputStream
[src]
pub unsafe fn SetOutputStream(
&self,
aOutputStream: *const nsIOutputStream
) -> nsresult
[src]
&self,
aOutputStream: *const nsIOutputStream
) -> nsresult
void setOutputStream (in nsIOutputStream aOutputStream);
pub unsafe fn WriteBoolean(&self, aBoolean: bool) -> nsresult
[src]
/**
* Write a boolean as an 8-bit char to the stream.
*/
void writeBoolean (in boolean aBoolean);
pub unsafe fn Write8(&self, aByte: uint8_t) -> nsresult
[src]
void write8 (in uint8_t aByte);
pub unsafe fn Write16(&self, a16: uint16_t) -> nsresult
[src]
void write16 (in uint16_t a16);
pub unsafe fn Write32(&self, a32: uint32_t) -> nsresult
[src]
void write32 (in uint32_t a32);
pub unsafe fn Write64(&self, a64: uint64_t) -> nsresult
[src]
void write64 (in uint64_t a64);
pub unsafe fn WriteFloat(&self, aFloat: c_float) -> nsresult
[src]
void writeFloat (in float aFloat);
pub unsafe fn WriteDouble(&self, aDouble: c_double) -> nsresult
[src]
void writeDouble (in double aDouble);
pub unsafe fn WriteStringZ(&self, aString: *const c_char) -> nsresult
[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);
pub unsafe fn WriteWStringZ(&self, aString: *const int16_t) -> nsresult
[src]
/**
* Write a 16-bit pascal style string to the stream.
* 32-bit length field, followed by length PRUnichars.
*/
void writeWStringZ (in wstring aString);
pub unsafe fn WriteUtf8Z(&self, aString: *const int16_t) -> nsresult
[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);
pub unsafe fn WriteBytes(
&self,
aString: *const c_char,
aLength: uint32_t
) -> nsresult
[src]
&self,
aString: *const c_char,
aLength: uint32_t
) -> nsresult
/**
* Write an opaque byte array to the stream.
*/
void writeBytes ([size_is (aLength)] in string aString, in uint32_t aLength);
pub unsafe fn WriteByteArray(
&self,
aBytes: *mut uint8_t,
aLength: uint32_t
) -> nsresult
[src]
&self,
aBytes: *mut uint8_t,
aLength: uint32_t
) -> nsresult
/**
* 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>
pub fn coerce<T: nsIOutputStreamCoerce>(&self) -> &T
[src]
Cast this nsIOutputStream
to one of its base interfaces.
pub unsafe fn Close(&self) -> nsresult
[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 ();
pub unsafe fn Flush(&self) -> nsresult
[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 ();
pub unsafe fn Write(
&self,
aBuf: *const c_char,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
[src]
&self,
aBuf: *const c_char,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
/**
* 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);
pub unsafe fn WriteFrom(
&self,
aFromStream: *const nsIInputStream,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
[src]
&self,
aFromStream: *const nsIInputStream,
aCount: uint32_t,
_retval: *mut uint32_t
) -> nsresult
/**
* 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);
pub unsafe fn IsNonBlocking(&self, _retval: *mut bool) -> nsresult
[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]
const IID: nsIID
IID: nsIID = nsID(542041616, 34661, 4563, [144, 207, 0, 64, 5, 106, 144, 110])
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 nsIBinaryOutputStream
[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 nsIBinaryOutputStream
[src]
type Target = nsIOutputStream
The resulting type after dereferencing.
fn deref(&self) -> &nsIOutputStream
[src]
Dereferences the value.