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

File stream class. More...

#import <SCFileStream.h>

Inheritance diagram for SCFileStream:
SCStream SCObject <SCCoding> <SCDictionaring> <SCStreaming> <SCCollectioning>

Instance Properties

SCFileStreamOpenMode openMode
 

Creating File Streams

(SCFileStream *) + fileStreamWithPath:mode:delegate:handling:
 
(SCFileStream *) + fileStreamWithPath:mode:delegate:
 
(SCFileStream *) + fileStreamWithPath:mode:
 
(SCFileStream *) + fileStreamWithPath:
 
(SCFileStream *) + readOnlyFileStreamWithPath:
 
(SCFileStream *) + writeOnlyFileStreamWithPath:
 
(SCFileStream *) + appendFileStreamWithPath:
 
(SCFileStream *) + fileStream
 

Initializing File Streams

(id) - initWithPath:mode:delegate:handling:
 
(id) - initWithPath:mode:delegate:
 
(id) - initWithPath:mode:
 
(id) - initWithPath:
 
(id) - initReadOnlyWithPath:
 
(id) - initWriteOnlyWithPath:
 
(id) - initAppendWithPath:
 
(id) - init
 

Reading and Writing Data

(SCUSize- readBytes:toBuffer:
 
(SCUSize- writeBytes:fromBuffer:
 

Opening and Closing Stream

(void) - openWithPath:mode:handling:
 
(void) - openWithPath:mode:
 
(void) - openWithPath:
 
(void) - openReadOnlyWithPath:
 
(void) - openWriteOnlyWithPath:
 
(void) - openAppendWithPath:
 
(void) - close
 

Seeking Stream

(void) - setOffset:whence:
 
(void) - setOffset:
 
(SCLong- offset
 
(void) - rewind
 

Additional Inherited Members

- Instance Methods inherited from SCStream
(void) - setErrorHandling:
 
(void) - setDelegate:
 
(void) - resetStats
 
(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:
 
(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:
 
(NSString *) - readStringWithEncoding:
 
(NSString *) - readStringWithMax:
 
(NSString *) - readString
 
(void) - writeString:
 
- 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>
- Properties inherited from SCStream
SCStreamErrorHandling errorHandling
 
SCStreamStatus status
 
NSString * name
 
BOOL opened
 
BOOL readable
 
BOOL writable
 
BOOL readOnly
 
BOOL writeOnly
 
BOOL readWrite
 
id object
 
SCStreamExceptionstreamException
 
SCSystemExceptionsystemException
 
id< SCStreamDelegatedelegate
 
BOOL eof
 
SCULong totalRead
 
SCULong totalWrite
 
SCULong lastRead
 
SCULong lastWrite
 

Detailed Description

File stream class.

Since
version 1.1.3

Implements the file stream access based on the abstract class SCStream.
Class instances can thrown the following exceptions:

Method Documentation

+ (SCFileStream *) appendFileStreamWithPath: (NSString *)  path

Returns the opened in the append only mode file stream created by using the specified path.

Parameters
path- the path to the file stream
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) close

Closes the receiving file stream.

+ (SCFileStream *) fileStream

Returns the file stream created by using the default settings.

Returns
A created file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (SCFileStream *) fileStreamWithPath: (NSString *)  path

Returns the opened in the read only mode file stream created by using the specified path.

Parameters
path- the path to the file stream
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (SCFileStream *) fileStreamWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode 

Returns the opened file stream created by using the specified path and open mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (SCFileStream *) fileStreamWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode
delegate: (id<SCStreamDelegate>)  delegate 

Returns the opened file stream created by using the specified path, open mode and delegate object.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
delegate- the file stream delegate object
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
+ (SCFileStream *) fileStreamWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode
delegate: (id<SCStreamDelegate>)  delegate
handling: (SCStreamErrorHandling handling 

Returns the opened file stream created by using the specified path, open mode, delegate object and error handling mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
delegate- the file stream delegate object
handling- the error handling mode:
  • SCStreamErrorHandlingSystem - generate the system exception
  • SCStreamErrorHandlingStream - generate the stream exception
  • SCStreamErrorHandlingStatus - change the file stream status
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) init

Initializes the file stream using the default settings.

Returns
A newly initialized file stream

Reimplemented from SCStream.

- (id) initAppendWithPath: (NSString *)  path

Initializes and opens in the append only mode the file stream using the specified path.

Parameters
path- the path to the file stream
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initReadOnlyWithPath: (NSString *)  path

Initializes and opens in the read only mode the file stream using the specified path.

Parameters
path- the path to the file stream
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initWithPath: (NSString *)  path

Initializes and opens in the read only mode the file stream using the specified path.

Parameters
path- the path to the file stream
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode 

Initializes and opens file stream by using the specified path and open mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode
delegate: (id<SCStreamDelegate>)  delegate 

Initializes and opens file stream by using the specified path, open mode and delegate object.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
delegate- the file stream delegate object
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode
delegate: (id<SCStreamDelegate>)  delegate
handling: (SCStreamErrorHandling handling 

Initializes and opens file stream by using the specified path, open mode, delegate object and error handling mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
delegate- the file stream delegate object
handling- the error handling mode:
  • SCStreamErrorHandlingSystem - generate the system exception
  • SCStreamErrorHandlingStream - generate the stream exception
  • SCStreamErrorHandlingStatus - change the file stream status
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (id) initWriteOnlyWithPath: (NSString *)  path

Initializes and opens in the write only mode the file stream using the specified path.

Parameters
path- the path to the file stream
Returns
A newly initialized and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCLong) offset

Returns the receiving file stream position from the file stream start.

Returns
A number of characters from the file stream start
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openAppendWithPath: (NSString *)  path

Opens for appending the receiving file stream by using the specified path.

Parameters
path- the path to the file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openReadOnlyWithPath: (NSString *)  path

Opens for reading the receiving file stream by using the specified path.

Parameters
path- the path to the file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openWithPath: (NSString *)  path

Opens for reading and writing the receiving file stream by using the specified path.

Parameters
path- the path to the file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode 

Opens the receiving file stream by using the specified path and open mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openWithPath: (NSString *)  path
mode: (SCFileStreamOpenMode mode
handling: (SCStreamErrorHandling handling 

Opens the receiving file stream by using the specified path, open mode and error handling mode.

Parameters
path- the path to the file stream
mode- the file stream opening mode:
  • SCFileStreamOpenReadOnly - read only mode
  • SCFileStreamOpenReadWrite - read and write mode
  • SCFileStreamOpenWriteOnly - write only mode
  • SCFileStreamOpenWriteRead - write and read mode with the file truncated
  • SCFileStreamOpenAppendWriteOnly - append only mode
  • SCFileStreamOpenAppendReadWrite - append and read mode
handling- the error handling mode:
  • SCStreamErrorHandlingSystem - generate the system exception
  • SCStreamErrorHandlingStream - generate the stream exception
  • SCStreamErrorHandlingStatus - change the file stream status
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) openWriteOnlyWithPath: (NSString *)  path

Opens for writing the receiving file stream by using the specified path.

Parameters
path- the path to the file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCUSize) readBytes: (SCUSize count
toBuffer: (void *)  buffer 

Reads from the receiving file stream the specified number of characters into a given buffer.

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

Reimplemented from SCStream.

+ (SCFileStream *) readOnlyFileStreamWithPath: (NSString *)  path

Returns the opened in the read only mode file stream created by using the specified path.

Parameters
path- the path to the file stream
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) rewind

Sets the receiving file stream position to the start of the file stream.

Exceptions
SCStreamException- stream error detected
- (void) setOffset: (SCLong offset

Sets the receiving file stream position to the specified offset from the file stream start.

Parameters
offset- the stream offset
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (void) setOffset: (SCLong offset
whence: (SCFileStreamOffsetWhence whence 

Sets the receiving file stream position to the specified offset and whence.

Parameters
offset- the stream offset
whence- the stream offset whence:
  • SCFileStreamOffsetStart - offset is set from the file stream start
  • SCFileStreamOffsetCurrent - offset is set from the current position
  • SCFileStreamOffsetEnd - offset is set from the file stream end
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected
- (SCUSize) writeBytes: (SCUSize count
fromBuffer: (const void *)  buffer 

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

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

Reimplemented from SCStream.

+ (SCFileStream *) writeOnlyFileStreamWithPath: (NSString *)  path

Returns the opened in the write only mode file stream created by using the specified path.

Parameters
path- the path to the file stream
Returns
A created and opened file stream
Exceptions
SCStreamException- stream error detected
SCSystemException- system error detected

Property Documentation

- (SCFileStreamOpenMode) openMode
readnonatomicassign

File stream opening mode


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