Class: NSStream
Overview
NSStream is an abstract class for objects representing streams. Its interface is common to all Cocoa stream classes, including its concrete subclasses NSInputStream and NSOutputStream.
Direct Known Subclasses
Instance Method Summary (collapse)
-
- close
Closes the receiver.
-
- delegate
Returns the receiver’s delegate.
-
- open
Opens the receiving stream.
-
- propertyForKey:
Returns the receiver’s property for a given key.
-
- removeFromRunLoop:forMode:
Removes the receiver from a given run loop running in a given mode.
-
- scheduleInRunLoop:forMode:
Schedules the receiver on a given run loop in a given mode.
-
- setDelegate:
Sets the receiver’s delegate.
-
- setProperty:forKey:
Attempts to set the value of a given property of the receiver and returns a Boolean value that indicates whether the value is accepted by the receiver.
-
- streamError
Returns an NSError object representing the stream error.
-
- streamStatus
Returns the receiver’s status.
Methods inherited from NSObject
#!, #!=, #!~, #, #==, #===, #=~, #Rational, #__callee__, #__method__, #__send__, #__type__, `, alloc, allocWithZone:, #autoContentAccessingProxy, autoload, autoload?, autorelease_pool, #awakeAfterUsingCoder:, binding, block_given?, caller, cancelPreviousPerformRequestsWithTarget:, cancelPreviousPerformRequestsWithTarget:selector:object:, catch, class, classFallbacksForKeyedArchiver, #classForCoder, #classForKeyedArchiver, classForKeyedUnarchiver, #clone, conformsToProtocol:, #copy, copyWithZone:, #dealloc, #define_singleton_method, description, display, #doesNotRecognizeSelector:, #dup, #enum_for, #eql?, #equal?, #extend, fail, #finalize, format, #forwardInvocation:, #forwardingTargetForSelector:, framework, #freeze, #frozen?, getpass, gets, global_variables, #init, initialize, #initialize_clone, #initialize_copy, #initialize_dup, #inspect, instanceMethodForSelector:, instanceMethodSignatureForSelector:, #instance_eval, #instance_exec, #instance_of?, #instance_variable_defined?, #instance_variable_get, #instance_variable_set, #instance_variables, instancesRespondToSelector:, isSubclassOfClass:, #is_a?, iterator?, #kind_of?, lambda, load, load_bridge_support_file, load_plist, local_variables, loop, #method, #methodForSelector:, #methodSignatureForSelector:, #methods, #mutableCopy, mutableCopyWithZone:, new, #nil?, open, p, #performSelector:onThread:withObject:waitUntilDone:, #performSelector:onThread:withObject:waitUntilDone:modes:, #performSelector:withObject:afterDelay:, #performSelector:withObject:afterDelay:inModes:, #performSelectorInBackground:withObject:, #performSelectorOnMainThread:withObject:waitUntilDone:, #performSelectorOnMainThread:withObject:waitUntilDone:modes:, print, printf, #private_methods, proc, #protected_methods, #public_method, #public_methods, #public_send, putc, puts, raise, rand, readline, readlines, #replacementObjectForCoder:, #replacementObjectForKeyedArchiver:, require, resolveClassMethod:, resolveInstanceMethod:, #respond_to?, #respond_to_missing?, select, #send, setVersion:, #singleton_methods, sprintf, srand, superclass, #taint, #tainted?, #tap, test, throw, #to_plist, #to_s, trace_var, trap, #trust, #untaint, untrace_var, #untrust, #untrusted?, version
Constructor Details
This class inherits a constructor from NSObject
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class NSObject
Instance Method Details
- (Object) close
Closes the receiver. Closing the stream terminates the flow of bytes and releases system resources that were reserved for the stream when it was opened. If the stream has been scheduled on a run loop, closing the stream implicitly removes the stream from the run loop. A stream that is closed can still be queried for its properties.
- (Object) delegate
Returns the receiver’s delegate. By default, a stream is its own delegate, and subclasses of NSInputStream and NSOutputStream must maintain this contract.
- (Object) open
Opens the receiving stream. A stream must be created before it can be opened. Once opened, a stream cannot be closed and reopened.
- (Object) propertyForKey(key)
Returns the receiver’s property for a given key.
- (Object) removeFromRunLoop(aRunLoop, forMode:mode)
Removes the receiver from a given run loop running in a given mode.
- (Object) scheduleInRunLoop(aRunLoop, forMode:mode)
Schedules the receiver on a given run loop in a given mode. Unless the client is polling the stream, it is responsible for ensuring that the stream is scheduled on at least one run loop and that at least one of the run loops on which the stream is scheduled is being run.
- (Object) setDelegate(delegate)
Sets the receiver’s delegate. By default, a stream is its own delegate, and subclasses of NSInputStream and NSOutputStream must maintain this contract. If you override this method in a subclass, passing nil must restore the receiver as its own delegate. Delegates are not retained.To learn about delegates and delegation, read ““Delegation” in Cocoa Fundamentals Guide” in Cocoa Fundamentals Guide.
- (Boolean) setProperty(property, forKey:key)
Attempts to set the value of a given property of the receiver and returns a Boolean value that indicates whether the value is accepted by the receiver.
- (NSStreamStatus) streamStatus
Returns the receiver’s status.
See “Constants” for a description of the available NSStreamStatus constants.