#import <ObjectiveLib/FileOutStream.h>
Inheritance diagram for OLFileOutStream:
Public Member Functions | |
(void) | - close |
Close the stream. | |
(ol_fd) | - fileDescriptor |
Return the file descriptor associated with the file stream. | |
(void) | - flush |
Flush the stream. | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(unsigned) | - writeBytes:count: |
Write a sequence of bytes to the stream. | |
Initializers and Deallocators | |
(id) | - initWithFileDescriptor: |
Initialize the stream. | |
(id) | - initWithPath: |
Initialize the stream. | |
(id) | - initWithPath:append: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithPath: |
Create and return a new file out stream. | |
Protected Attributes | |
ol_fd | fd |
The file descriptor of the file to which data is sent. |
This is a concrete connected stream that is connected to a file. All data written will be sent to the file.
- (void) close |
Close the stream.
After receiving this message the stream will no longer be available for writing.
OLInputOutputException | if there is an error closing the stream |
Reimplemented from OLOutStream.
- (ol_fd) fileDescriptor |
Return the file descriptor associated with the file stream.
- (void) flush |
Flush the stream.
Any data that is pending or buffered will be written and the stream will be restored to a pristine state.
OLInputOutputException | if there is an error flushing the stream |
Reimplemented from OLOutStream.
- (void) freeStreamResources |
Free the stream's resources.
This secondary freeing method is necessary to allow the reference count to be properly manipulated from within the normal free (OLReferenceCountedStream) method.
Reimplemented from OLReferenceCountedStream.
- (id) initWithFileDescriptor: | (ol_fd) | fileDesc |
Initialize the stream.
The stream will be created with the given file descriptor and all new data will be appended to the given file. The stream will take ownership of the file descriptor and will assume that the stream is responsible for closing the file descriptor.
fileDesc | the file descriptor of the file to which to write |
- (id) initWithPath: | (const char *) | path |
Initialize the stream.
The stream will be created with the given file name. If a file already exists at the given path, then that file will be erased and a new file will written in its place.
OLInputOutputException | if a file cannot be opened with the given file name |
path | the path to the file |
- (id) initWithPath: | (const char *) | path | ||
append: | (BOOL) | append | ||
Initialize the stream.
The stream will be created with the given file name. If a file already exists at the given path, then that file will either be truncated or appended to depending on the value of append.
OLInputOutputException | if a file cannot be opened with the given file name |
path | the path to the file | |
append | YES if data should be appended to an existing file, NO if an existing file should be truncated |
+ (id) streamWithPath: | (const char *) | path |
Create and return a new file out stream.
A new stream is created with the given path. If a file already exists at the indicated path, then that file will be deleted and a new one will be created in its place.
OLInputOutputException | if the path cannot be converted to a file name or if a file cannot be opened with the given file name |
path | the path |
- (unsigned) writeBytes: | (const uint8_t *) | bytes | ||
count: | (unsigned) | count | ||
Write a sequence of bytes to the stream.
As many bytes up to the value of count will be written to the file, and the actual number written will be returned.
OLInputOutputException | if there is an error writing to the stream |
bytes | the bytes to write | |
count | the number of bytes to write |
Reimplemented from OLOutStream.
|