blackberry.com
BlackBerry Dynamics
Runtime library for macOS applications
from the application developer portal

GDFileHandle.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2017 BlackBerry Limited. All rights reserved.
00003  *
00004  */
00005 
00006 #pragma once
00007 
00008 #import <Foundation/Foundation.h>
00009 #import "GDPortability.h"
00010 
00011 GD_NS_ASSUME_NONNULL_BEGIN
00012 
00241 @interface GDFileHandle : NSFileHandle
00242 
00243 - (NSData *)readDataToEndOfFile;
00244 - (NSData *)readDataOfLength:(NSUInteger)length;
00245 
00246 - (void)writeData:(NSData *)data;
00247 - (unsigned long long)seekToEndOfFile;
00248 - (void)seekToFileOffset:(unsigned long long)offset;
00249 - (void)truncateFileAtOffset:(unsigned long long)offset;
00250 - (void)synchronizeFile;
00251 - (void)closeFile;
00252 
00253 - (instancetype)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)closeopt;
00254 - (GD_NSNULLABLE instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
00255 
00256 + (GD_NSNULLABLE instancetype)fileHandleForReadingAtPath:(NSString *)path;
00257 + (GD_NSNULLABLE instancetype)fileHandleForWritingAtPath:(NSString *)path;
00258 + (GD_NSNULLABLE instancetype)fileHandleForUpdatingAtPath:(NSString *)path;
00259 
00260 + (GD_NSNULLABLE instancetype)fileHandleForReadingFromURL:(NSURL *)url error:(NSError **)error;
00261 + (GD_NSNULLABLE instancetype)fileHandleForWritingToURL:(NSURL *)url error:(NSError **)error;
00262 + (GD_NSNULLABLE instancetype)fileHandleForUpdatingURL:(NSURL *)url error:(NSError **)error;
00263 
00264 @property (atomic, readonly, copy) NSData *availableData;
00265 @property (atomic, readonly) unsigned long long offsetInFile;
00266 @property (atomic, readonly) int fileDescriptor;
00267 
00268 // unavailable
00269 + (NSFileHandle *)fileHandleWithStandardInput;
00270 + (NSFileHandle *)fileHandleWithStandardOutput;
00271 + (NSFileHandle *)fileHandleWithStandardError;
00272 + (NSFileHandle *)fileHandleWithNullDevice;
00273 - (void)readInBackgroundAndNotifyForModes:(GD_NSNULLABLE GD_NSArray(NSString *) *)modes;
00274 - (void)readInBackgroundAndNotify;
00275 - (void)readToEndOfFileInBackgroundAndNotifyForModes:(GD_NSNULLABLE GD_NSArray(NSString *) *)modes;
00276 - (void)readToEndOfFileInBackgroundAndNotify;
00277 - (void)acceptConnectionInBackgroundAndNotifyForModes:(GD_NSNULLABLE GD_NSArray(NSString *) *)modes;
00278 - (void)acceptConnectionInBackgroundAndNotify;
00279 - (void)waitForDataInBackgroundAndNotifyForModes:(GD_NSNULLABLE GD_NSArray(NSString *) *)modes;
00280 - (void)waitForDataInBackgroundAndNotify;
00281 //
00282 
00283 @end
00284 
00285 GD_NS_ASSUME_NONNULL_END