Samond Classes Library 1.2.0-RELEASE build 166
List of all members
SCStream Class Reference

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

#import <SCStream.h>

Inheritance diagram for SCStream:
SCObject <SCCoding> <SCDictionaring> <SCStreaming> <SCCollectioning> SCFileStream SCNullStream SCStandardErrorStream SCStandardInputStream SCStandardOutputStream

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
 
(void) - setErrorHandling:
 
(void) - setDelegate:
 

Initializing Streams

(id) - init
 

Data Reading

(SCUSize- readBytes:toBuffer:
 
(id< SCStreaming >) - 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
 
(SCUSize- readToByte:
 
(SCUSize- readToUByte:
 
(SCUSize- readToShort:
 
(SCUSize- readToUShort:
 
(SCUSize- readToInteger:
 
(SCUSize- readToUInteger:
 
(SCUSize- readToLong:
 
(SCUSize- readToULong:
 
(SCUSize- readToChar:
 
(SCUSize- readToUnichar:
 
(SCUSize- readToCharString:max:
 
(SCUSize- readToBool:
 
(SCUSize- readToFloat:
 
(SCUSize- readToDouble:
 

Data Writing

(SCUSize- 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:
 

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
(id) - initWithCoder:
 
(id) - initWithContentsOfSerializedFile:
 
(void) - encodeWithCoder:
 
(BOOL) - writeContentsToSerializedFile:
 
(id) - initWithDataDictionary:
 
(id) - initWithDataDictionaryFromFile:
 
(void) - writeToDataDictionary:
 
(void) - writeToDataDictionaryFile:atomically:
 
(void) - writeToDataDictionaryFile:
 
(NSDictionary *) - dataDictionary
 
(id) - initWithStream:
 
(id) - initWithFileStream:
 
(void) - writeToStream:
 
(void) - writeToFileStream:
 
(void) - appendToFileStream:
 
(id< SCCollectioning >) - copyObject
 
(SCComparisonResult- compareWithObject:
 
(BOOL) - isEqual:
 
- Instance Methods inherited from <SCCoding>
- Instance Methods inherited from <SCDictionaring>
- Instance Methods inherited from <SCCollectioning>

Detailed Description

Abstract parent class of the stream classes hierarchy.

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

- (id) init

Initializes the stream by using the default settings.

Attention
Designed initializer
Returns
A newly initialized stream

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

- (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
- (SCUSize) readBytes: (SCUSize count
toBuffer: (void *)  buffer 

Reads the specified characters count into the specified buffer.@ This abstract method must be overrided in the all child classes.

Parameters
count- the number of the bytes to read from the stream into the specified buffer
buffer- the pointer to the receiving data buffer
Returns
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
- (id< SCStreaming >) 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: (SCUInteger 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: (SCUInteger 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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:
- (SCUSize) readToCharString: (char *)  buffer
max: (SCUSize 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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
- (SCUSize) 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:
- (SCUSize) 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) setDelegate: (id<SCStreamDelegate>)  delegate

Sets the stream delegate object.

Parameters
delegate- the stream delegate object
- (void) setErrorHandling: (SCStreamErrorHandling mode

Sets the stream error handling mode.

Parameters
mode- the error handling mode:
  • SCStreamErrorHandlingSystem - system exception generation
  • SCStreamErrorHandlingStream - stream exception generation
  • SCStreamErrorHandlingStatus - stream status changing
- (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
- (SCUSize) writeBytes: (SCUSize count
fromBuffer: (const void *)  buffer 

Writes to the receiving stream the specified number of characters from the specified data buffer.
This abstract method must be overriden in the all child classes.

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
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) 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
readwritenonatomicassign

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
readatomicretain

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
readnonatomicassign

Last detected stream exception

- (SCSystemException *) systemException
readnonatomicassign

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: