mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-02 01:21:08 +00:00
Revert "NSURLSession Reimplementation (#411)"
This reverts commit 07233534e6
.
This commit is contained in:
parent
07233534e6
commit
3fedf31c2d
50 changed files with 7197 additions and 5391 deletions
52
Source/GSURLSessionTaskBodySource.h
Normal file
52
Source/GSURLSessionTaskBodySource.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
#ifndef INCLUDED_GSURLSESSIONTASKBODYSOURCE_H
|
||||
#define INCLUDED_GSURLSESSIONTASKBODYSOURCE_H
|
||||
|
||||
#import "common.h"
|
||||
#import "GSDispatch.h"
|
||||
|
||||
@class NSFileHandle;
|
||||
@class NSInputStream;
|
||||
|
||||
typedef NS_ENUM(NSUInteger, GSBodySourceDataChunk) {
|
||||
GSBodySourceDataChunkData,
|
||||
// The source is depleted.
|
||||
GSBodySourceDataChunkDone,
|
||||
// Retry later to get more data.
|
||||
GSBodySourceDataChunkRetryLater,
|
||||
GSBodySourceDataChunkError
|
||||
};
|
||||
|
||||
/*
|
||||
* A (non-blocking) source for body data.
|
||||
*/
|
||||
@protocol GSURLSessionTaskBodySource <NSObject>
|
||||
|
||||
/*
|
||||
* Get the next chunck of data.
|
||||
*/
|
||||
- (void) getNextChunkWithLength: (NSInteger)length
|
||||
completionHandler: (void (^)(GSBodySourceDataChunk chunk, NSData *data))completionHandler;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSBodyStreamSource : NSObject <GSURLSessionTaskBodySource>
|
||||
|
||||
- (instancetype) initWithInputStream: (NSInputStream*)inputStream;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSBodyDataSource : NSObject <GSURLSessionTaskBodySource>
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
@interface GSBodyFileSource : NSObject <GSURLSessionTaskBodySource>
|
||||
|
||||
- (instancetype) initWithFileURL: (NSURL*)fileURL
|
||||
workQueue: (dispatch_queue_t)workQueue
|
||||
dataAvailableHandler: (void (^)(void))dataAvailableHandler;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue