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

File stream class. More...

#import <SCFileStream.h>

+ Inheritance diagram for SCFileStream:

Instance Properties

NSString * path
 
SCFileStreamOpenMode openMode
 

Creating File Streams

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

Initializing File Streams

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

Reading and Writing Data

(SCSize- readBytes:toBuffer:
 
(SCSize- writeBytes:fromBuffer:
 

Opening and Closing Streams

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

Seeking Streams

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

Additional Inherited Members

- Instance Methods inherited from SCStream
(void) - resetStats
 
(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:
 
(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:
 
(NSString *) - readStringWithEncoding:
 
(NSString *) - readStringWithMax:
 
(NSString *) - readString
 
(void) - writeString:
 
- 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 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
 
- Properties inherited from SCObject
NSString * className
 

Detailed Description

File stream class.

SDK
macOS 10.6+, iOS 7.0+, GNUstep
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

+ (instancetype) 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.

+ (instancetype) 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
+ (instancetype) 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
+ (instancetype) 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
+ (instancetype) 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
+ (instancetype) 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
- (instancetype) init

Initializes the file stream using the default settings.

Returns
A newly initialized file stream

Reimplemented from SCStream.

- (instancetype) 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
- (instancetype) 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
- (instancetype) 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
- (instancetype) 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
- (instancetype) 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
- (instancetype) 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
- (instancetype) 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
- (NSInteger) 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
- (SCSize) readBytes: (SCSize 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.

+ (instancetype) 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: (NSInteger)  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: (NSInteger)  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
- (SCSize) writeBytes: (SCSize 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.

+ (instancetype) 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

- (NSString *) path
readnonatomicretain

A path of the file stream


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