SFBOutputSource
@interface SFBOutputSource : NSObject
                An output source
- 
                  
                  
Returns an initialized \c SFBOutputSource object for the given URL or \c nil on failure
Declaration
Objective-C
+ (nullable instancetype)outputSourceForURL:(nonnull NSURL *)url error: (NSError *_Nullable *_Nullable)error;Parameters
urlThe URL
errorAn optional pointer to a \c NSError to receive error information
Return Value
An initialized \c SFBOutputSource object for the specified URL, or \c nil on failure
 - 
                  
                  
Returns an initialized \c SFBOutputSource writing to an internal data object
Declaration
Objective-C
+ (nonnull instancetype)dataOutputSource; - 
                  
                  
Returns an initialized \c SFBOutputSource for the given buffer
Declaration
Objective-C
+ (nonnull instancetype)outputSourceWithBuffer:(nonnull void *)buffer capacity:(NSInteger)capacity;Parameters
bufferA buffer to receive output
capacityThe capacity of \c buffer in bytes
Return Value
An initialized \c SFBOutputSource object
 - 
                  
                  
Returns the URL corresponding to this output source or \c nil if none
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSURL *url; - 
                  
                  
Returns the underlying data object for this output source or \c nil if none
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSData *data; - 
                  
                  
Opens the output source for writing
Declaration
Objective-C
- (BOOL)openReturningError:(NSError *_Nullable *_Nullable)error;Parameters
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Closes the output source
Declaration
Objective-C
- (BOOL)closeReturningError:(NSError *_Nullable *_Nullable)error;Parameters
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Returns \c YES if the output source is open
Declaration
Objective-C
@property (nonatomic, readonly) BOOL isOpen; - 
                  
                  
Reads bytes from the input
Declaration
Objective-C
- (BOOL)readBytes:(nonnull void *)buffer length:(NSInteger)length bytesRead:(nonnull NSInteger *)bytesRead error:(NSError *_Nullable *_Nullable)error;Parameters
bufferA buffer to receive data
lengthThe maximum number of bytes to read
bytesReadThe number of bytes actually read
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES if any bytes were read, \c NO otherwise
 - 
                  
                  
Writes bytes to the output
Declaration
Objective-C
- (BOOL)writeBytes:(nonnull const void *)buffer length:(NSInteger)length bytesWritten:(nonnull NSInteger *)bytesWritten error:(NSError *_Nullable *_Nullable)error;Parameters
bufferA buffer of data to write
lengthThe maximum number of bytes to write
bytesWrittenThe number of bytes actually written
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES if any bytes were written, \c NO otherwise
 - 
                  
                  
Returns \c YES if the end of input has been reached
Declaration
Objective-C
@property (nonatomic, readonly) BOOL atEOF; - 
                  
                  
Returns the current offset in the output, in bytes
Declaration
Objective-C
- (BOOL)getOffset:(nonnull NSInteger *)offset error:(NSError *_Nullable *_Nullable)error; - 
                  
                  
Returns the length of the output, in bytes
Declaration
Objective-C
- (BOOL)getLength:(nonnull NSInteger *)length error:(NSError *_Nullable *_Nullable)error; - 
                  
                  
Returns \c YES if the output is seekable
Declaration
Objective-C
@property (nonatomic, readonly) BOOL supportsSeeking; - 
                  
                  
Seeks to the specified byte offset
Declaration
Objective-C
- (BOOL)seekToOffset:(NSInteger)offset error:(NSError *_Nullable *_Nullable)error;Parameters
offsetThe desired offset, in bytes
Return Value
\c YES on success, \c NO otherwise
 
- 
                  
                  
Writes data to the output
Declaration
Objective-C
- (BOOL)writeData:(nonnull NSData *)data error:(NSError *_Nullable *_Nullable)error;Parameters
dataThe data to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 
- 
                  
                  
Writes an 8-bit signed integer to the output
Declaration
Objective-C
- (BOOL)writeInt8:(int8_t)i8 error:(NSError *_Nullable *_Nullable)error;Parameters
i8The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 16-bit signed integer to the output
Declaration
Objective-C
- (BOOL)writeInt16:(int16_t)i16 error:(NSError *_Nullable *_Nullable)error;Parameters
i16The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 32-bit signed integer to the output
Declaration
Objective-C
- (BOOL)writeInt32:(int32_t)i32 error:(NSError *_Nullable *_Nullable)error;Parameters
i32The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 64-bit signed integer to the output
Declaration
Objective-C
- (BOOL)writeInt64:(int64_t)i64 error:(NSError *_Nullable *_Nullable)error;Parameters
i64The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 
- 
                  
                  
Writes an 8-bit unsigned integer to the output
Declaration
Objective-C
- (BOOL)writeUInt8:(uint8_t)ui8 error:(NSError *_Nullable *_Nullable)error;Parameters
ui8The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 16-bit unsigned integer to the output
Declaration
Objective-C
- (BOOL)writeUInt16:(uint16_t)ui16 error:(NSError *_Nullable *_Nullable)error;Parameters
ui16The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 32-bit unsigned integer to the output
Declaration
Objective-C
- (BOOL)writeUInt32:(uint32_t)ui32 error:(NSError *_Nullable *_Nullable)error;Parameters
ui32The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 64-bit unsigned integer to the output
Declaration
Objective-C
- (BOOL)writeUInt64:(uint64_t)ui64 error:(NSError *_Nullable *_Nullable)error;Parameters
ui64The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 
- 
                  
                  
Writes an 16-bit unsigned integer to the output in big-endian format
Declaration
Objective-C
- (BOOL)writeUInt16BigEndian:(uint16_t)ui16 error:(NSError *_Nullable *_Nullable)error;Parameters
ui16The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 32-bit unsigned integer to the output in big-endian format
Declaration
Objective-C
- (BOOL)writeUInt32BigEndian:(uint32_t)ui32 error:(NSError *_Nullable *_Nullable)error;Parameters
ui32The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 64-bit unsigned integer to the output in big-endian format
Declaration
Objective-C
- (BOOL)writeUInt64BigEndian:(uint64_t)ui64 error:(NSError *_Nullable *_Nullable)error;Parameters
ui64The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 
- 
                  
                  
Writes an 16-bit unsigned integer to the output in little-endian format
Declaration
Objective-C
- (BOOL)writeUInt16LittleEndian:(uint16_t)ui16 error:(NSError *_Nullable *_Nullable)error;Parameters
ui16The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 32-bit unsigned integer to the output in little-endian format
Declaration
Objective-C
- (BOOL)writeUInt32LittleEndian:(uint32_t)ui32 error:(NSError *_Nullable *_Nullable)error;Parameters
ui32The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Writes an 64-bit unsigned integer to the output in little-endian format
Declaration
Objective-C
- (BOOL)writeUInt64LittleEndian:(uint64_t)ui64 error:(NSError *_Nullable *_Nullable)error;Parameters
ui64The value to write
errorAn optional pointer to an \c NSError object to receive error information
Return Value
\c YES on success, \c NO otherwise
 - 
                  
                  
Reads bytes from the input
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func read(_ buffer: UnsafeMutableRawPointer, length: Int) throws -> IntParameters
bufferA buffer to receive data
lengthThe maximum number of bytes to read
Return Value
The number of bytes actually read
 - 
                  
                  
Writes bytes to the output
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func write(_ buffer: UnsafeRawPointer, length: Int) throws -> IntParameters
bufferA buffer of data to write
lengthThe maximum number of bytes to write
Return Value
The number of bytes actually written
 - 
                  
                  
Returns the current offset in the output, in bytes
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func offset() throws -> Int - 
                  
                  
Returns the length of the output, in bytes
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func length() throws -> Int - 
                  
                  
Writes bytes to the output
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func write(_ data: Data) throwsParameters
dataThe data to write
 - 
                  
                  
Writes a binary integer to the output
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func write<T>(_ i: T) throws where T : BinaryIntegerParameters
iThe value to write
 - 
                  
                  
Writes a 16-bit integer to the output in big-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeBigEndian(_ ui16: UInt16) throwsParameters
ui16The value to write
 - 
                  
                  
Writes a 32-bit integer to the output in big-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeBigEndian(_ ui32: UInt32) throwsParameters
ui32The value to write
 - 
                  
                  
Writes a 64-bit integer to the output in little-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeBigEndian(_ ui64: UInt64) throwsParameters
ui64The value to write
 - 
                  
                  
Writes a 16-bit integer to the output in big-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeLittleEndian(_ ui16: UInt16) throwsParameters
ui16The value to write
 - 
                  
                  
Writes a 32-bit integer to the output in little-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeLittleEndian(_ ui32: UInt32) throwsParameters
ui32The value to write
 - 
                  
                  
Writes a 64-bit integer to the output in little-endian format
Throws
AnNSErrorobject if an error occursDeclaration
Swift
public func writeLittleEndian(_ ui64: UInt64) throwsParameters
ui64The value to write
 
View on GitHub
        SFBOutputSource Class Reference