Text file class.
More...
#import <SCTextFile.h>
Text file class.
- Since
- version 1.1.4
Class SCTextFile extends the parent class SCText by adding the methods for reading and writing disk text files.
Class instances can thrown the following exceptions:
- (BOOL) addTextFromStream: |
|
(SCStream *) |
stream |
|
Adds into the receiving text file the text from the specified input stream.
- Parameters
-
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) addTextWithPath: |
|
(NSString *) |
path |
|
Adds into the receiving text file the text from the file with the specified path.
- Parameters
-
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) appendTextInRange: |
|
(NSRange) |
range |
toFileWithPath: |
|
(NSString *) |
path |
|
|
| |
Appends the text in the specified range to the file with the specified path.
- Parameters
-
range | - appended text range |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) appendToFileWithPath: |
|
(NSString *) |
path |
|
Appends the currect content of the receiving text file into the file with the specified path.
- Parameters
-
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (SCText *) cutAndAppendTextInRange: |
|
(NSRange) |
range |
toFileWithPath: |
|
(NSString *) |
path |
|
|
| |
Cuts the text in the specified range and appends it to the file with the specified path.
- Parameters
-
range | - cut text range |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
Cuts the text in the specified range and writes it to the specified stream.
- Parameters
-
range | - cut text range |
stream | - output stream |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
Cuts the text in the specified range and writes it to the file with the specified path.
- Parameters
-
range | - cut text range |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (id) initFromStream: |
|
(SCStream *) |
stream |
|
Initializes a text file using the specified input stream.
- Parameters
-
stream | - open input stream |
- Returns
- A newly initialized text file
- Exceptions
-
Initializes a text file using the specified text name and file path.
- Parameters
-
name | - text name |
path | - source file path |
- Returns
- A newly initialized text file
- Exceptions
-
Initializes a text file using the specified text name and input stream.
- Parameters
-
name | - text name |
stream | - open input stream |
- Returns
- A newly initialized text file
- Exceptions
-
- (id) initWithPath: |
|
(NSString *) |
path |
|
Initializes a text file using the specified file path.
- Parameters
-
- Returns
- A newly initialized text file
- Exceptions
-
Initializes a text file using the specified existing text file.
- Parameters
-
textFile | - existing source text file |
- Returns
- A newly initialized text file
- Exceptions
-
- (BOOL) insertTextFromStream: |
|
(SCStream *) |
stream |
atIndex: |
|
(SCIndex) |
index |
|
|
| |
Reads the text from the specified input stream and inserts it into the receiving text file at a given index.
- Parameters
-
stream | - input stream |
index | - destination index |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) insertTextWithPath: |
|
(NSString *) |
path |
atIndex: |
|
(SCIndex) |
index |
|
|
| |
Reads the text from the file with the specified path and inserts it into the receiving text file at a given index.
- Parameters
-
path | - source file path |
index | - destination index |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
Removes the currect content of the receiving text file and reads the text from the text file with the default path.
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) readFromStream: |
|
(SCStream *) |
stream |
|
Removes the current content of the receiving text file and reads the text from the specified stream.
- Parameters
-
stream | - source input stream |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) readWithPath: |
|
(NSString *) |
path |
|
Removes the currect content of the receiving text file and reads the text from the file with the specified file.
- Parameters
-
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
Replaces the all occurrences of the specified text with the text from the specified stream.
- Parameters
-
text | - replaced text |
stream | - input stream |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) replaceText: |
|
(SCStrings *) |
text |
withTextWithPath: |
|
(NSString *) |
path |
|
|
| |
Replaces the all occurrences of the specified text with the text from the file with the specified path.
- Parameters
-
text | - replaced text |
path | - source file path |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) replaceTextInRange: |
|
(NSRange) |
range |
withTextFromStream: |
|
(SCStream *) |
stream |
|
|
| |
Replaces the text in the specified range with text loaded from the specified stream.
- Parameters
-
range | - replaced text range |
stream | - input stream |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) replaceTextInRange: |
|
(NSRange) |
range |
withTextWithPath: |
|
(NSString *) |
path |
|
|
| |
Replaces the text in the specified range with text loaded from the file with the specified path.
- Parameters
-
range | - replaced text range |
path | - source file path |
- Returns
- YES if the reading operation is successfully, otherwise NO
- Exceptions
-
Discards all receiving text changes and reloads content from the file with the default path.
- Returns
- YES if the operation is successfully, otherwise NO
- Exceptions
-
Replaces the content and settings of the receiving text file by the content and settings of the specified text file.
- Parameters
-
textFile | - existing source text file |
- Exceptions
-
Returns an unnamed empty text file created by using the default settings.
- Returns
- A created text file
Returns a text file created by using the specified input stream.
- Parameters
-
stream | - open input stream |
- Returns
- A created text file
- Exceptions
-
+ (SCTextFile *) textFileWithCoder: |
|
(NSCoder *) |
coder |
|
Returns a text file created by using the specified coder.
- Parameters
-
- Returns
- A created text file
+ (SCTextFile *) textFileWithCollection: |
|
(id) |
collection |
|
Returns a text file created by using the strings from the specified existing collection of any supported type.
- Parameters
-
collection | - collection with the source strings |
- Returns
- A created text file
- Exceptions
-
+ (SCTextFile *) textFileWithContentsOfSerializedFile: |
|
(NSString *) |
path |
|
Returns a text file created by using the content of the serialized file with the specified path.
- Parameters
-
path | - source serialized file path |
- Returns
- A created text file
+ (SCTextFile *) textFileWithDataDictionary: |
|
(NSDictionary *) |
dictionary |
|
Returns a text file created by using the specified data dictionary.
- Parameters
-
dictionary | - source dictionary |
- Returns
- A created text file
+ (SCTextFile *) textFileWithDataDictionaryFromFile: |
|
(NSString *) |
path |
|
Returns a text file created by using the data dictionary from the specified file.
- Parameters
-
path | - source data dictionary file path |
- Returns
- A created text file
+ (SCTextFile *) textFileWithFileStream: |
|
(NSString *) |
path |
|
Returns a text file created by using the data from the file stream with the specified path.
- Parameters
-
- Returns
- A created text file
- Exceptions
-
+ (SCTextFile *) textFileWithName: |
|
(NSString *) |
name |
|
Returns a text file created by using the specified text name.
- Parameters
-
- Returns
- A created text file
Returns a text file created by using the specified text name and file path.
- Parameters
-
name | - text name |
path | - source file path |
- Returns
- A created text file
- Exceptions
-
Returns a text file created by using the specified text name and input stream.
- Parameters
-
name | - text name |
stream | - open input stream |
- Returns
- A created text file
- Exceptions
-
+ (SCTextFile *) textFileWithPath: |
|
(NSString *) |
path |
|
Returns a text file created by using the specified file path.
- Parameters
-
- Returns
- A created text file
- Exceptions
-
Returns a text file created by using the data from the specified stream.
- Parameters
-
stream | - stream for reading class instance |
- Returns
- A created text file
- Exceptions
-
+ (SCTextFile *) textFileWithString: |
|
(NSString *) |
string |
|
Returns a text file created by using the specified existing string.
- Parameters
-
string | - existing source string |
- Returns
- A created text file
- Exceptions
-
Returns a text file created by using the specified existing strings list.
- Parameters
-
strings | - existing source strings list |
- Returns
- A created text file
- Exceptions
-
Returns a text file created by using the specified existing text.
- Parameters
-
text | - existing source test |
- Returns
- A created text file
- Exceptions
-
Returns a text file created by using the specified existing text file.
- Parameters
-
textFile | - existing source text file |
- Returns
- A created text file
- Exceptions
-
Writes the content of the receiving text file into the file with the default path.
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextInRange: |
|
(NSRange) |
range |
toStream: |
|
(SCStream *) |
stream |
|
|
| |
Writes the text in the specified range to the specified stream.
- Parameters
-
range | - writed text range |
stream | - output stream |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextInRange: |
|
(NSRange) |
range |
withPath: |
|
(NSString *) |
path |
|
|
| |
Writes the text in the specified range to the file with the specified path.
- Parameters
-
range | - writed text range |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextToStream: |
|
(SCStream *) |
stream |
|
Writes the content of the receiving text file into the specified output stream.
- Parameters
-
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextWithoutSubstring: |
|
(NSString *) |
substring |
toStream: |
|
(SCStream *) |
stream |
|
|
| |
Writes into the specified stream strings from the receiving text file that does not contain a given substring.
- Parameters
-
substring | - required substring |
stream | - output stream |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextWithoutSubstring: |
|
(NSString *) |
substring |
withPath: |
|
(NSString *) |
path |
|
|
| |
Writes into the file with the specified path the strings from the receiving text file that does not contain a given substring.
- Parameters
-
substring | - required substring |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextWithSubstring: |
|
(NSString *) |
substring |
toStream: |
|
(SCStream *) |
stream |
|
|
| |
Writes into the specified stream strings from the receiving text file that contain a given substring.
- Parameters
-
substring | - required substring |
stream | - output stream |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeTextWithSubstring: |
|
(NSString *) |
substring |
withPath: |
|
(NSString *) |
path |
|
|
| |
Writes into the file with the specified path strings from the receiving text file that contain a given substring.
- Parameters
-
substring | - required substring |
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
- (BOOL) writeWithPath: |
|
(NSString *) |
path |
|
Writes the content of the receiving text file into the file with the specified path.
- Parameters
-
path | - destination file path |
- Returns
- YES if the writing operation is successfully, otherwise NO
- Exceptions
-
Contains the path to the text file.
Returns the text with the copy of all receiving text file strings.
The documentation for this class was generated from the following files: