Class: NSStream

Inherits:
NSObject show all

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

NSInputStream, NSOutputStream

Instance Method Summary (collapse)

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.

Returns:

- (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.

Returns:

- (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.

Returns:

- (Object) propertyForKey(key)

Returns the receiver’s property for a given key.

Parameters:

  • key (String)

    The key for one of the receiver’s properties. See “Constants” for a description of the available property-key constants and associated values.

Returns:

  • (Object)

    The receiver’s property for the key key.

- (Object) removeFromRunLoop(aRunLoop, forMode:mode)

Removes the receiver from a given run loop running in a given mode.

Parameters:

  • aRunLoop (NSRunLoop)

    The run loop on which the receiver was scheduled.

  • mode (String)

    The mode for the run loop.

Returns:

- (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.

Parameters:

  • aRunLoop (NSRunLoop)

    The run loop on which to schedule the receiver.

  • mode (String)

    The mode for the run loop.

Returns:

- (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.

Parameters:

  • delegate (Object)

    The delegate for the receiver.

Returns:

- (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.

Parameters:

  • property (Object)

    The value for key.

  • key (String)

    The key for one of the receiver’s properties. See “Constants” for a description of the available property-key constants and expected values.

Returns:

  • (Boolean)

    YES if the value is accepted by the receiver, otherwise NO.

- (NSError) streamError

Returns an NSError object representing the stream error.

Returns:

  • (NSError)

    An NSError object representing the stream error, or nil if no error has been encountered.

- (NSStreamStatus) streamStatus

Returns the receiver’s status.

See “Constants” for a description of the available NSStreamStatus constants.

Returns:

  • (NSStreamStatus)

    The receiver’s status.