2007-03-02 01:36:52 +00:00
|
|
|
//
|
|
|
|
// FileSource.m
|
|
|
|
// FileSource
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/1/07.
|
|
|
|
// Copyright 2007 __MyCompanyName__. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#import "FileSource.h"
|
|
|
|
|
|
|
|
|
|
|
|
@implementation FileSource
|
|
|
|
|
|
|
|
- (BOOL)buffered
|
|
|
|
{
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)open:(NSURL *)url
|
|
|
|
{
|
|
|
|
_fd = fopen([[url path] UTF8String], "r");
|
|
|
|
|
|
|
|
return (_fd != NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSDictionary *)properties
|
|
|
|
{
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)seekable
|
|
|
|
{
|
2007-03-04 00:17:05 +00:00
|
|
|
return NO;
|
2007-03-02 01:36:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL)seek:(long)position whence:(int)whence
|
|
|
|
{
|
|
|
|
return (fseek(_fd, position, whence) == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (long)tell
|
|
|
|
{
|
|
|
|
return ftell(_fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int)read:(void *)buffer amount:(int)amount
|
|
|
|
{
|
|
|
|
return fread(buffer, 1, amount, _fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)close
|
|
|
|
{
|
|
|
|
fclose(_fd);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (NSArray *)schemes
|
|
|
|
{
|
|
|
|
return [NSArray arrayWithObject:@"file"];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|