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

DDLogFileInfo Class Reference

#import <DDFileLogger.h>

Public Member Functions

(id) - initWithFilePath:
(void) - reset
(void) - renameFile:
(BOOL) - hasExtendedAttributeWithName:
(void) - addExtendedAttributeWithName:
(void) - removeExtendedAttributeWithName:
(NSComparisonResult) - reverseCompareByCreationDate:
(NSComparisonResult) - reverseCompareByModificationDate:

Static Public Member Functions

(id) + logFileWithPath:

Properties

NSString * filePath
NSString * fileName
NSDictionary * fileAttributes
NSDate * creationDate
NSDate * modificationDate
unsigned long long fileSize
NSTimeInterval age
BOOL isArchived

Detailed Description

Definition at line 279 of file DDFileLogger.h.


Member Function Documentation

- (void) addExtendedAttributeWithName: (NSString *)  attrName

param NSString

Definition at line 1610 of file DDFileLogger.m.

                                    :(NSString *)attrName
{
    // Create a constant read only local attribute
        const char *path = [filePath UTF8String];
        const char *name = [attrName UTF8String];
        
        int result = setxattr(path, name, NULL, 0, 0, 0);
        
        if (result < 0)
        {
                NSLogError(@"DDLogFileInfo: setxattr(%@, %@): error = %i", attrName, self.fileName, result);
        }
}
- (BOOL) hasExtendedAttributeWithName: (NSString *)  attrName

param NSString returns BOOL

param NSString returns boolean

Definition at line 1596 of file DDFileLogger.m.

                                    :(NSString *)attrName
{
    // Create a constant read only local attribute
        const char *path = [filePath UTF8String];
        const char *name = [attrName UTF8String];
        
        ssize_t result = getxattr(path, name, NULL, 0, 0, 0);
        
        return (result >= 0);
}
- (id) initWithFilePath: (NSString *)  aFilePath

Initialize the DDLogFileInfo with a file path param NSString returns id

Initialize with a file path

Definition at line 1180 of file DDFileLogger.m.

                      :(NSString *)aFilePath
{
        if ((self = [super init]))
        {
                filePath = [aFilePath copy];
        }
        return self;
}
+ (id) logFileWithPath: (NSString *)  aFilePath

Class method param NSString returns id

Class method

Definition at line 1172 of file DDFileLogger.m.

                     :(NSString *)aFilePath
{
        return [[[DDLogFileInfo alloc] initWithFilePath:aFilePath] autorelease];
}
- (void) removeExtendedAttributeWithName: (NSString *)  attrName

param NSString

Definition at line 1627 of file DDFileLogger.m.

                                       :(NSString *)attrName
{
    // Create a constant read only local attribute
        const char *path = [filePath UTF8String];
        const char *name = [attrName UTF8String];
        
        int result = removexattr(path, name, 0);
        
        if (result < 0 && errno != ENOATTR)
        {
                NSLogError(@"DDLogFileInfo: removexattr(%@, %@): error = %i", attrName, self.fileName, result);
        }
}
- (void) renameFile: (NSString *)  newFileName

param NSString

Rename the log file param NSString

Definition at line 1399 of file DDFileLogger.m.

                  :(NSString *)newFileName
{
        // This method is only used on the iPhone simulator, where normal extended attributes are broken.
        // See full explanation in the header file.
        
        if (![newFileName isEqualToString:[self fileName]])
        {
                NSString *fileDir = [filePath stringByDeletingLastPathComponent];
                
                NSString *newFilePath = [fileDir stringByAppendingPathComponent:newFileName];
                
                NSLogVerbose(@"DDLogFileInfo: Renaming file: '%@' -> '%@'", self.fileName, newFileName);
                
                NSError *error = nil;
                if (![[NSFileManager defaultManager] moveItemAtPath:filePath toPath:newFilePath error:&error])
                {
                        NSLogError(@"DDLogFileInfo: Error renaming file (%@): %@", self.fileName, error);
                }
                
                [filePath release];
                filePath = [newFilePath retain];
                
                [self reset];
        }
}
- (void) reset

Definition at line 1380 of file DDFileLogger.m.

{
        [fileName release];
        fileName = nil;
        
        [fileAttributes release];
        fileAttributes = nil;
        
        [creationDate release];
        creationDate = nil;
        
        [modificationDate release];
        modificationDate = nil;
}
- (NSComparisonResult) reverseCompareByCreationDate: (DDLogFileInfo *)  another

param DDLogFileInfo returns NSComparisonResult

Definition at line 1668 of file DDFileLogger.m.

                                                  :(DDLogFileInfo *)another
{
        NSDate *us = [self creationDate];
        NSDate *them = [another creationDate];
        
        NSComparisonResult result = [us compare:them];
        
        if (result == NSOrderedAscending)
                return NSOrderedDescending;
        
        if (result == NSOrderedDescending)
                return NSOrderedAscending;
        
        return NSOrderedSame;
}
- (NSComparisonResult) reverseCompareByModificationDate: (DDLogFileInfo *)  another

param DDLogFileInfo returns NSComparisonResult

Definition at line 1688 of file DDFileLogger.m.

                                                      :(DDLogFileInfo *)another
{
        NSDate *us = [self modificationDate];
        NSDate *them = [another modificationDate];
        
        NSComparisonResult result = [us compare:them];
        
        if (result == NSOrderedAscending)
                return NSOrderedDescending;
        
        if (result == NSOrderedDescending)
                return NSOrderedAscending;
        
        return NSOrderedSame;
}

Property Documentation

- (NSTimeInterval) age [read, assign]

Gets the age of the log file returns NSTimeInterval

Definition at line 321 of file DDFileLogger.h.

- (NSDate *) creationDate [read, assign]

The creation date

The log file creation date returns NSDate

Definition at line 299 of file DDFileLogger.h.

- (NSDictionary *) fileAttributes [read, assign]

Definition at line 294 of file DDFileLogger.h.

- (NSString *) fileName [read, assign]

The log file name

returns NSString

Definition at line 289 of file DDFileLogger.h.

- (NSString *) filePath [read, assign]

The file path of the log file

Definition at line 284 of file DDFileLogger.h.

- (unsigned long long) fileSize [read, assign]

Gets the file size returns value between 0 and 9,223,372,036,854,775,807

Definition at line 308 of file DDFileLogger.h.

- (BOOL) isArchived [read, write, assign]

Whether the log file is archived returns BOOL

Definition at line 323 of file DDFileLogger.h.

- (NSDate *) modificationDate [read, assign]

The modification date

returns NSDate

Definition at line 304 of file DDFileLogger.h.


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