#import <ObjectiveLib/FileInStream.h>
Inheritance diagram for OLFileInStream:
Public Member Functions | |
(void) | - close |
Close the stream. | |
(ol_fd) | - fileDescriptor |
Return the file descriptor associated with the file stream. | |
(void) | - freeStreamResources |
Free the stream's resources. | |
(unsigned) | - readBytes:count: |
Read a sequence of bytes from the stream. | |
Initializers and Deallocators | |
(id) | - initWithFileDescriptor: |
Initialize the stream. | |
(id) | - initWithPath: |
Initialize the stream. | |
Static Public Member Functions | |
(id) | + streamWithPath: |
Create and return a new file in stream. | |
Protected Attributes | |
ol_fd | fd |
The file descriptor of the file from which data is read. |
This is a concrete connected stream that is connected to a file.
- (void) close |
Close the stream.
After receiving this message the stream will no long be available for reading.
OLInputOutputException | if there is an error closing the stream |
Reimplemented from OLInStream.
- (ol_fd) fileDescriptor |
Return the file descriptor associated with the file stream.
- (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 read starting from the file's current position. 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.
OLInputOutputException | if a file cannot be opened with the given file name |
path | the path to the file |
- (unsigned) readBytes: | (uint8_t *) | buffer | ||
count: | (unsigned) | max | ||
Read a sequence of bytes from the stream.
Bytes up to the amount of max are read from the file. The number of bytes read is returned except in the case where the end of the file has been reached. Rather than raising an exception in this case, this method returns UINT_MAX.
OLInputOutputException | if there is an error reading from the stream |
buffer | the address to which the bytes should be read | |
max | the maximum number bytes that should be read |
Reimplemented from OLInStream.
+ (id) streamWithPath: | (const char *) | path |
Create and return a new file in stream.
A new stream is created with the given path.
OLInputOutputException | if a file cannot be opened with the given file name |
path | the path |
|