Instance Method

getBuffer(_:length:)

Returns by reference a pointer to a read buffer and, by reference, the number of bytes available, and returns a Boolean value that indicates whether the buffer is available.

Declaration

func getBuffer(_ buffer: UnsafeMutablePointer<UnsafeMutablePointer<UInt8>?>, length len: UnsafeMutablePointer<Int>) -> Bool

Parameters

buffer

Upon return, contains a pointer to a read buffer. The buffer is only valid until the next stream operation is performed.

len

Upon return, contains the number of bytes available.

Return Value

true if the buffer is available, otherwise false.

Subclasses of NSInputStream may return false if this operation is not appropriate for the stream type.

See Also

Using Streams

func read(UnsafeMutablePointer<UInt8>, maxLength: Int) -> Int

Reads up to a given number of bytes into a given buffer.

var hasBytesAvailable: Bool

A Boolean value that indicates whether the receiver has bytes available to read.