IOS Streaming Browser 1.0
An IOS streaming browser to stream the display to others or to a projector

HTTPFileResponse Class Reference

#import <HTTPFileResponse.h>

Inheritance diagram for HTTPFileResponse:
Collaboration diagram for HTTPFileResponse:

Public Member Functions

(id) - initWithFilePath:forConnection:
(NSString *) - filePath

Protected Attributes

HTTPConnectionconnection
NSString * filePath
UInt64 fileLength
UInt64 fileOffset
BOOL aborted
int fileFD
void * buffer
NSUInteger bufferSize

Detailed Description

Definition at line 7 of file HTTPFileResponse.h.


Member Function Documentation

- (NSString *) filePath

Gets the file path returns NSString

- (id) initWithFilePath: (NSString *)  fpath
forConnection: (HTTPConnection *)  parent 

Initialize the HTTPFile response with a filepath and connection param NSSTring param HTTPConnection returns id

Initialize the HTTPFileResponse with a file path and HTTPConnection param NSString param HTTPConnection returns id

Definition at line 21 of file HTTPFileResponse.m.

                      :(NSString *)fpath forConnection:(HTTPConnection *)parent
{
        if((self = [super init]))
        {
                
                connection = parent; // Parents retain children, children do NOT retain parents
                
        // copies the file path into the instance variable
                filePath = [fpath copy];
        
        // If there is no file path then decrement the reference count for self and return nil
                if (filePath == nil)
                {
                        
                        [self release];
                        return nil;
                }
                
        // Gets an NSDictionary of key/value pairs containing the attributes of the item (file, directory, symlink, etc.)
                NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
        
        // If there are no file attributed, then decrement the 
                if (fileAttributes == nil)
                {
                        
                        [self release];
                        return nil;
                }
                
        // Gets the file size
                fileLength = (UInt64)[[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue];
        
        // Sets the file offset to the beginning of the file
                fileOffset = 0;
                
        // Whether file response has been aborted
                aborted = NO;
                
                // We don't bother opening the file here.
                // If this is a HEAD request we only need to know the fileLength.
                fileFD = NULL_FD;
        }
        return self;
}

Field Documentation

- (BOOL) aborted [protected]

Whether the file response has been aborted

Definition at line 35 of file HTTPFileResponse.h.

- (void*) buffer [protected]

The file buffer

Definition at line 45 of file HTTPFileResponse.h.

- (NSUInteger) bufferSize [protected]

The buffer size

Definition at line 50 of file HTTPFileResponse.h.

- (HTTPConnection*) connection [protected]

Definition at line 14 of file HTTPFileResponse.h.

- (int) fileFD [protected]

The file descriptor

Definition at line 40 of file HTTPFileResponse.h.

- (UInt64) fileLength [protected]

The length of the file

Definition at line 25 of file HTTPFileResponse.h.

- (UInt64) fileOffset [protected]

The file offset

Definition at line 30 of file HTTPFileResponse.h.

- (NSString *) filePath [protected]

The path to the file

Returns the filePath as string returns NSString

Definition at line 20 of file HTTPFileResponse.h.


The documentation for this class was generated from the following files:
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Defines