Up
Authors
- Derek Zhou (
derekzhou@gmail.com
)
-
Copyright: (C) 2006 Free Software Foundation, Inc.
- Declared in:
- Foundation/NSStream.h
Availability: MacOS-X 10.4.0, Base 1.2.0
NSInputStream is a subclass of NSStream that
provides read-only stream functionality.
Method summary
+ (id)
inputStreamWithData: (
NSData*)data;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns an initialized NSInputStream
object for reading from data.
+ (id)
inputStreamWithFileAtPath: (
NSString*)path;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns an initialized NSInputStream
object that reads data from the file at the
specified path.
- (BOOL)
getBuffer: (uint8_t**)buffer
length: (
NSUInteger*)len;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns a pointer to the read buffer in
buffer and, by reference, the number of
bytes available in len.
- (BOOL)
hasBytesAvailable;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns YES
if the receiver has bytes
available to read. The receiver may also return
YES
if a read must be attempted in
order to determine the availability of bytes.
- (id)
initWithData: (
NSData*)data;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an initialized NSInputStream object for
reading from data.
- (id)
initWithFileAtPath: (
NSString*)path;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an initialized NSInputStream object for
reading from the file at the specified
path.
- (
NSInteger)
read: (uint8_t*)buffer
maxLength: (
NSUInteger)len;
Availability: MacOS-X 10.4.0, Base 1.2.0
Reads up to len bytes into
buffer, returning the actual number of
bytes read.
- Declared in:
- Foundation/NSStream.h
Availability: MacOS-X 10.4.0, Base 1.2.0
NSOutputStream is a subclass of NSStream that
provides write-only stream functionality.
Method summary
+ (id)
outputStreamToBuffer: (uint8_t*)buffer
capacity: (
NSUInteger)capacity;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns an initialized NSOutputStream
object that can write to buffer, up to a
maximum of capacity bytes.
+ (id)
outputStreamToFileAtPath: (
NSString*)path
append: (BOOL)shouldAppend;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns an initialized NSOutputStream
object for writing to the file specified by
path.
+ (id)
outputStreamToMemory;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns an initialized NSOutputStream
object that will write stream data to memory.
- (BOOL)
hasSpaceAvailable;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns YES
if the receiver can be
written to, or if a write must be attempted in
order to determine if space is available.
- (id)
initToBuffer: (uint8_t*)buffer
capacity: (
NSUInteger)capacity;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an initialized NSOutputStream object that
can write to buffer, up to a maximum of
capacity bytes.
- (id)
initToFileAtPath: (
NSString*)path
append: (BOOL)shouldAppend;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an initialized NSOutputStream object for
writing to the file specified by path.
If shouldAppend is
YES
, newly written data will be
appended to any existing file contents.
- (id)
initToMemory;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an initialized NSOutputStream object that
will write to memory.
- (
NSInteger)
write: (const uint8_t*)buffer
maxLength: (
NSUInteger)len;
Availability: MacOS-X 10.4.0, Base 1.2.0
Writes the contents of buffer, up to a
maximum of len bytes, to the receiver.
- Declared in:
- Foundation/NSStream.h
Availability: MacOS-X 10.4.0, Base 1.2.0
NSStream is an abstract class for objects
representing streams.
Method summary
+ (void)
getStreamsToHost: (
NSHost*)host
port: (
NSInteger)port
inputStream: (
NSInputStream**)inputStream
outputStream: (
NSOutputStream**)outputStream;
Availability: MacOS-X 10.4.0, Base 1.2.0
Creates and returns by reference an NSInputStream
object and NSOutputStream object for a socket
connection with the specified port on
host.
- (void)
close;
Availability: MacOS-X 10.4.0, Base 1.2.0
Closes the receiver.
Repeated calls to this
method on the same stream are quietly ignored.
- (id)
delegate;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns the receiver's delegate.
- (void)
open;
Availability: MacOS-X 10.4.0, Base 1.2.0
Opens the receiving stream.
Upon completion of
the open operation, an NSStreamEventOpenCompleted event
is sent to the recevier's delegate.
Repeated
calls to this method on the same stream are quietly
ignored.
- (id)
propertyForKey: (
NSString*)key;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns the receiver's property for the specified
key.
- (void)
removeFromRunLoop: (
NSRunLoop*)aRunLoop
forMode: (
NSString*)mode;
Availability: MacOS-X 10.4.0, Base 1.2.0
Removes the receiver from the NSRunLoop specified
by aRunLoop running in the mode.
Attempts to remove the receiver from a run
loop or a mode in which it has not been
scheduled are quietly ignored.
- (void)
scheduleInRunLoop: (
NSRunLoop*)aRunLoop
forMode: (
NSString*)mode;
Availability: MacOS-X 10.4.0, Base 1.2.0
Schedules the receiver on aRunLoop
using the specified mode.
You must
not attempt to add a stream to more than one run loop,
but you may call this method multiple times to add the
receiver in different modes for the same run loop.
- (void)
setDelegate: (id)delegate;
Availability: MacOS-X 10.4.0, Base 1.2.0
Sets the receiver's delegate.
- (BOOL)
setProperty: (id)property
forKey: (
NSString*)key;
Availability: MacOS-X 10.4.0, Base 1.2.0
Sets the value of the property specified by
key to property, returns
YES
if the key-value pair are accepted
by the receiver.
- (
NSError*)
streamError;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns an NSError object representing the stream
error, or nil
if no error has been
encountered.
- (
NSStreamStatus)
streamStatus;
Availability: MacOS-X 10.4.0, Base 1.2.0
Returns the receiver's status.
- Declared in:
- Foundation/NSStream.h
Availability: MacOS-X 10.4.0, Base 1.2.0
Informal protocol for delegates of instance of the
NSStream
class.
Method summary
- (void)
stream: (
NSStream*)sStream
handleEvent: (
NSStreamEvent)anEvent;
Availability: MacOS-X 10.4.0, Base 1.2.0
Description forthcoming.
- Declared in:
- Foundation/NSStream.h
- Conforms to:
- NSObject
Availability: MacOS-X 10.7.0, Base 1.2.0
Description forthcoming.
Method summary
- (void)
stream: (
NSStream*)sStream
handleEvent: (
NSStreamEvent)anEvent;
Availability: MacOS-X 10.7.0, Base 1.2.0
Description forthcoming.
Up