Samond Classes Library 1.2.6-STABLE build 219
List of all members
SCStream Class Reference

Abstract parent class of the stream classes hierarchy. More...

#import <SCStream.h>

+ Inheritance diagram for SCStream:

Instance Properties

SCStreamErrorHandling errorHandling
 
SCStreamStatus status
 
NSString * name
 
BOOL opened
 
BOOL readable
 
BOOL writable
 
BOOL readOnly
 
BOOL writeOnly
 
BOOL readWrite
 
id object
 
SCStreamExceptionstreamException
 
SCSystemExceptionsystemException
 
id< SCStreamDelegatedelegate
 

Initializing Streams

(instancetype) - init
 

Data Reading

(SCSize- readBytes:toBuffer:
 
(id) - readObject
 
(SCByte- readByte
 
(SCUByte- readUByte
 
(SCShort- readShort
 
(SCUShort- readUShort
 
(SCInteger- readInteger
 
(SCUInteger- readUInteger
 
(SCLong- readLong
 
(SCULong- readULong
 
(char) - readChar
 
(unichar) - readUnichar
 
(const char *) - readCharString
 
(BOOL) - readBool
 
(SCFloat- readFloat
 
(SCDouble- readDouble
 
(NSInteger) - readNSInteger
 
(NSUInteger) - readNSUInteger
 
(SCSize- readToByte:
 
(SCSize- readToUByte:
 
(SCSize- readToShort:
 
(SCSize- readToUShort:
 
(SCSize- readToInteger:
 
(SCSize- readToUInteger:
 
(SCSize- readToLong:
 
(SCSize- readToULong:
 
(SCSize- readToChar:
 
(SCSize- readToUnichar:
 
(SCSize- readToCharString:max:
 
(SCSize- readToBool:
 
(SCSize- readToFloat:
 
(SCSize- readToDouble:
 
(SCSize- readToNSInteger:
 
(SCSize- readToNSUInteger:
 

Data Writing

(SCSize- writeBytes:fromBuffer:
 
(void) - writeObject:
 
(void) - writeByte:
 
(void) - writeUByte:
 
(void) - writeShort:
 
(void) - writeUShort:
 
(void) - writeInteger:
 
(void) - writeUInteger:
 
(void) - writeLong:
 
(void) - writeULong:
 
(void) - writeChar:
 
(void) - writeUnichar:
 
(void) - writeCharString:
 
(void) - writeBool:
 
(void) - writeFloat:
 
(void) - writeDouble:
 
(void) - writeNSInteger:
 
(void) - writeNSUInteger:
 

Text Files Support

(NSString *) - readStringWithEncoding:max:
 
(NSString *) - readStringWithEncoding:
 
(NSString *) - readStringWithMax:
 
(NSString *) - readString
 
(void) - writeString:encoding:
 
(void) - writeString:
 

Stream Seeking

BOOL eof
 

Statistic Methods

SCULong totalRead
 
SCULong totalWrite
 
SCULong lastRead
 
SCULong lastWrite
 
(void) - resetStats
 

Additional Inherited Members

- Instance Methods inherited from SCObject
(instancetype) - initWithCoder:
 
(instancetype) - initWithContentsOfSerializedFile:
 
(void) - encodeWithCoder:
 
(BOOL) - writeContentsToSerializedFile:
 
(instancetype) - initWithDataDictionary:
 
(instancetype) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionary:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(instancetype) - initWithStream:
 
(instancetype) - initWithFileStream:
 
(void) - writeToStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
(id) - copyObject
 
(SCComparisonResult- compareWithObject:
 
(BOOL) - isEqual:
 
(instancetype) - initWithData:
 
(instancetype) - initWithDataWrapper:
 
(instancetype) - initWithContentsOfFile:
 
(instancetype) - initWithContentsOfURL:
 
(instancetype) - initWithContentsOfURLString:
 
(void) - writeToData:
 
(BOOL) - writeToFile:
 
(BOOL) - writeToURL:
 
(BOOL) - writeToURLString:
 
(NSData *) - data
 
- Properties inherited from SCObject
NSString * className
 

Detailed Description

Abstract parent class of the stream classes hierarchy.

SDK
macOS 10.6+, iOS 7.0+, GNUstep
Since
version 1.1.3

Declares the methods for stream operations support.
Class instances can thrown the following exceptions:

We are planning the following child classes and utilities:

Todo:

SCZeroStream - zero data input stream (/dev/zero)

SCRandomStream - randomized data input stream (/dev/random)

SCMemoryStream - memory stream class

SCSharedMemoryStream - shared memory (SHMMEM) stream class

File stream viewing utilities

Method Documentation

- (instancetype) init

Initializes the stream by using the default settings.

Attention
Designed initializer
Returns
A newly initialized stream

Reimplemented in SCFileStream, SCStandardErrorStream, SCStandardInputStream, SCStandardOutputStream, and SCNullStream.

- (BOOL) readBool

Reads from the receiving stream and returns the boolean value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCByte) readByte

Reads from the receiving stream and returns the signed 8-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readBytes: (SCSize count
toBuffer: (void *)  buffer 

Reads a given number of characters into the specified buffer.

Parameters
count- the number of the characters to read from the stream
buffer- the pointer to the receiving data buffer
Returns
An actually readed number of characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected

Reimplemented in SCFileStream.

- (char) readChar

Reads from the receiving stream and returns the character.

Returns
Character which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- readUnichar
- (const char *) readCharString

Reads from the receiving stream and returns the character string.

Returns
Character string which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCDouble) readDouble

Reads from the receiving stream and returns the double value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCFloat) readFloat

Reads from the receiving stream and returns the float value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCInteger) readInteger

Reads from the receiving stream and returns the signed 32-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCLong) readLong

Reads from the receiving stream and returns the signed 64-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSInteger) readNSInteger

Reads from the receiving stream and returns the NSInteger value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSUInteger) readNSUInteger

Reads from the receiving stream and returns the NSUInteger value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) readObject

Initializes and returns class instance from the receiving stream.

Returns
A newly initialized class instance or nil if the error is detected
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCShort) readShort

Reads from the receiving stream and returns the signed 16-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSString *) readString

Reads from the receiving stream and returns the string by using the UTF-8 encoding.

Returns
String which will be readed from the receiving stream or nil if the error is detected
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSString *) readStringWithEncoding: (NSStringEncoding)  encoding

Reads from the receiving stream and returns the string by using the specified encoding.

Parameters
encoding- the string encoding to read string from the receiving stream
Returns
String which will be readed from the receiving stream or nil if the error is detected
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSString *) readStringWithEncoding: (NSStringEncoding)  encoding
max: (SCInteger max 

Reads from the receiving stream and returns the string with the specified maximum length by using a given encoding.

Parameters
encoding- the string encoding to read string from the receiving stream
max- the maximum length of the string
Returns
String which will be readed from the receiving stream or nil if the error is detected
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (NSString *) readStringWithMax: (SCInteger max

Reads from the receiving stream and returns the string with the specified maximum length by using the UTF-8 encoding.

Parameters
max- the maximum length of the string
Returns
String which will be readed from the receiving stream or nil if the error is detected
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToBool: (BOOL *)  buffer

Reads from the receiving stream the boolean value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToByte: (SCByte *)  buffer

Reads from the receiving stream the signed 8-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToChar: (char *)  buffer

Reads from the receiving stream the character into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- readToUnichar:
- (SCSize) readToCharString: (char *)  buffer
max: (SCSize max 

Reads from the receiving stream the character string into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
max- the maximum number of characters to read from the stream
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToDouble: (SCDouble *)  buffer

Reads from the receiving stream the double value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToFloat: (SCFloat *)  buffer

Reads from the receiving stream the float value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToInteger: (SCInteger *)  buffer

Reads from the receiving stream the signed 32-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToLong: (SCULong *)  buffer

Reads from the receiving stream the signed 64-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToNSInteger: (NSInteger *)  buffer

Reads from the receiving stream the NSInteger value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToNSUInteger: (NSUInteger *)  buffer

Reads from the receiving stream the NSUInteger value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToShort: (SCShort *)  buffer

Reads from the receiving stream the signed 16-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToUByte: (SCUByte *)  buffer

Reads from the receiving stream the unsigned 8-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToUInteger: (SCUInteger *)  buffer

Reads from the receiving stream the unsigned 32-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToULong: (SCULong *)  buffer

Reads from the receiving stream the unsigned 64-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) readToUnichar: (unichar *)  buffer

Reads from the receiving stream the character into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- readToChar:
- (SCSize) readToUShort: (SCUShort *)  buffer

Reads from the receiving stream the unsigned 16-bit integer value into the specified buffer.

Parameters
buffer- the pointer to the buffer for the reading data
Returns
Number of the actually readed characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCUByte) readUByte

Reads from the receiving stream and returns the unsigned 8-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCUInteger) readUInteger

Reads from the receiving stream and returns the unsigned 32-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCULong) readULong

Reads from the receiving stream and returns the unsigned 64-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (unichar) readUnichar

Reads from the receiving stream and returns the character.

Returns
Character which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- readChar
- (SCUShort) readUShort

Reads from the receiving stream and returns the unsigned 16-bit integer value.

Returns
Value which readed from the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) resetStats

Resets the stream statistic.

- (void) writeBool: (BOOL)  variable

Writes to the receiving stream the specified boolean value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeByte: (SCByte variable

Writes to the receiving stream the specified signed 8-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCSize) writeBytes: (SCSize count
fromBuffer: (const void *)  buffer 

Writes to the receiving stream the specified number of characters from the specified data buffer.

Parameters
count- the number of characters to write to the receiving stream
buffer- the pointer to the buffer with the data to write to the receiving stream
Returns
A number of the actually writed into the stream characters
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected

Reimplemented in SCFileStream.

- (void) writeChar: (char)  variable

Writes to the receiving stream the specified character.

Parameters
variable- the character to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- writeUnichar:
- (void) writeCharString: (const char *)  variable

Writes to the receiving stream the specified character string.

Parameters
variable- the character string to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeDouble: (SCDouble variable

Writes to the receiving stream the specified double value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeFloat: (SCFloat variable

Writes to the receiving stream the specified float value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeInteger: (SCInteger variable

Writes to the receiving stream the specified signed 32-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeLong: (SCLong variable

Writes to the receiving stream the specified signed 64-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeNSInteger: (NSInteger)  variable

Writes to the receiving stream the specified NSInteger value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeNSUInteger: (NSUInteger)  variable

Writes to the receiving stream the specified NSUInteger value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeObject: (id<SCStreaming>)  object

Writes to the receiving stream the specified class instance.

Parameters
object- the class instance to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeShort: (SCShort variable

Writes to the receiving stream the specified signed 16-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeString: (NSString *)  string

Writes to the receiving stream the specified string by using the UTF-8 encoding.

Parameters
string- the string to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeString: (NSString *)  string
encoding: (NSStringEncoding)  encoding 

Writes to the receiving stream the specified string by using a given encoding.

Parameters
string- the string to write to the receiving stream
encoding- the string encoding to write string to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeUByte: (SCUByte variable

Writes to the receiving stream the specified unsigned 8-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeUInteger: (SCUInteger variable

Writes to the receiving stream the specified unsigned 32-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeULong: (SCULong variable

Writes to the receiving stream the specified unsigned 64-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) writeUnichar: (unichar)  variable

Writes to the receiving stream the specified character.

Parameters
variable- the character to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
See also
- writeChar:
- (void) writeUShort: (SCUShort variable

Writes to the receiving stream the specified unsigned 16-bit integer value.

Parameters
variable- the value to write to the receiving stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected

Property Documentation

- (id<SCStreamDelegate>) delegate
readwritenonatomicretain

Stream events handler

- (BOOL) eof
readnonatomicassign

Flag determines the end of the stream

- (SCStreamErrorHandling) errorHandling
readwritenonatomicassign

Error handling mode

- (SCULong) lastRead
readnonatomicassign

Number of the readed characters during the last operation

- (SCULong) lastWrite
readnonatomicassign

Number of the writed characters during the last operation

- (NSString*) name
readnonatomicretain

Stream name

- (id) object
readnonatomicassign

Pointer to the current readed object

- (BOOL) opened
readnonatomicassign

Stream opening flag: YES if the stream is opened and NO if the stream is closed

- (BOOL) readable
readnonatomicassign

Flag determines the ability to read from the stream

- (BOOL) readOnly
readnonatomicassign

Flag determines whether the stream is read only

- (BOOL) readWrite
readnonatomicassign

Flag determines whether the stream supports both read and write operations

- (SCStreamStatus) status
readnonatomicassign

Stream current support

- (SCStreamException*) streamException
readnonatomicretain

Last detected stream exception

- (SCSystemException*) systemException
readnonatomicretain

Last detected system exception

- (SCULong) totalRead
readnonatomicassign

Number of the totally readed characters

- (SCULong) totalWrite
readnonatomicassign

Number of the totally writed characters

- (BOOL) writable
readnonatomicassign

Flag determines the ability to write to the stream

- (BOOL) writeOnly
readnonatomicassign

Flag determines whether the stream is write only


The documentation for this class was generated from the following files: