2006-02-15 17:34:47 +00:00
|
|
|
/** Implementation for NSStream for GNUStep
|
|
|
|
Copyright (C) 2006 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Derek Zhou <derekzhou@gmail.com>
|
|
|
|
Written by: Richard Frith-Macdonald <rfm@gnu.org>
|
|
|
|
Date: 2006
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Foundation/NSData.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSRunLoop.h>
|
|
|
|
#include <Foundation/NSException.h>
|
|
|
|
#include <Foundation/NSError.h>
|
|
|
|
#include <Foundation/NSValue.h>
|
|
|
|
#include <Foundation/NSHost.h>
|
|
|
|
|
|
|
|
#include "../GSStream.h"
|
|
|
|
|
|
|
|
@implementation NSStream
|
|
|
|
|
|
|
|
+ (void) getStreamsToHost: (NSHost *)host
|
|
|
|
port: (int)port
|
|
|
|
inputStream: (NSInputStream **)inputStream
|
|
|
|
outputStream: (NSOutputStream **)outputStream
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) close
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) open
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDelegate: (id)delegate
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) delegate
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) setProperty: (id)property forKey: (NSString *)key
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) propertyForKey: (NSString *)key
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) scheduleInRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) removeFromRunLoop: (NSRunLoop *)aRunLoop forMode: (NSString *)mode;
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSError *) streamError
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSStreamStatus) streamStatus
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSInputStream
|
|
|
|
|
|
|
|
+ (id) inputStreamWithData: (NSData *)data
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) inputStreamWithFileAtPath: (NSString *)path
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithData: (NSData *)data
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initWithFileAtPath: (NSString *)path
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) read: (uint8_t *)buffer maxLength: (unsigned int)len
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) getBuffer: (uint8_t **)buffer length: (unsigned int *)len
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasBytesAvailable
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NSOutputStream
|
|
|
|
|
|
|
|
+ (id) outputStreamToMemory
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) outputStreamToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) outputStreamToFileAtPath: (NSString *)path append: (BOOL)shouldAppend
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initToMemory
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initToBuffer: (uint8_t *)buffer capacity: (unsigned int)capacity
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initToFileAtPath: (NSString *)path append: (BOOL)shouldAppend
|
|
|
|
{
|
2006-02-16 19:19:30 +00:00
|
|
|
[self notImplemented: _cmd];
|
2006-02-15 17:34:47 +00:00
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (int) write: (const uint8_t *)buffer maxLength: (unsigned int)len
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) hasSpaceAvailable
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
return NO;
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2006-02-16 19:19:30 +00:00
|
|
|
@implementation GSServerStream
|
|
|
|
|
|
|
|
+ (id) serverStreamToAddr: (NSString*)addr port: (int)port
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd];
|
2006-02-17 06:31:04 +00:00
|
|
|
return nil;
|
2006-02-16 19:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+ (id) serverStreamToAddr: (NSString*)addr
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd];
|
2006-02-17 06:31:04 +00:00
|
|
|
return nil;
|
2006-02-16 19:19:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initToAddr: (NSString*)addr port: (int)port
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (id) initToAddr: (NSString*)addr
|
|
|
|
{
|
|
|
|
[self notImplemented: _cmd];
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) acceptWithInputStream: (NSInputStream **)inputStream
|
|
|
|
outputStream: (NSOutputStream **)outputStream
|
|
|
|
{
|
|
|
|
[self subclassResponsibility: _cmd];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|
|
|
|
|