Wiselib
Public Member Functions | Public Attributes
AsyncReadPacket Class Reference

The AsyncReadPacket encompasses the instructions for any given read. More...

List of all members.

Public Member Functions

(id) - initWithData:startOffset:maxLength:timeout:readLength:terminator:tag:
(NSUInteger) - readLengthForNonTerm
 For read packets without a set terminator, returns the safe length of data that can be read without exceeding the maxLength, or forcing a resize of the buffer if at all possible.
(NSUInteger) - readLengthForTerm
 For read packets with a set terminator, returns the safe length of data that can be read without going over a terminator, or the maxLength, or forcing a resize of the buffer if at all possible.
(NSUInteger) - readLengthForTermWithPreBuffer:found:
 For read packets with a set terminator, returns the safe length of data that can be read from the given preBuffer, without going over a terminator or the maxLength.
(NSUInteger) - prebufferReadLengthForTerm
 Assuming pre-buffering is enabled, returns the amount of data that can be read without going over the maxLength.
(NSInteger) - searchForTermAfterPreBuffering:
 For read packets with a set terminator, scans the packet buffer for the term.

Public Attributes

NSMutableData * buffer
NSUInteger startOffset
NSUInteger bytesDone
NSUInteger maxLength
NSTimeInterval timeout
NSUInteger readLength
NSData * term
BOOL bufferOwner
NSUInteger originalBufferLength
long tag

Detailed Description

The AsyncReadPacket encompasses the instructions for any given read.

The content of a read packet allows the code to determine if we're:


Member Function Documentation

- (id) initWithData: (NSMutableData *)  d
startOffset: (NSUInteger)  s
maxLength: (NSUInteger)  m
timeout: (NSTimeInterval)  t
readLength: (NSUInteger)  l
terminator: (NSData *)  e
tag: (long)  i 
- (NSUInteger) prebufferReadLengthForTerm

Assuming pre-buffering is enabled, returns the amount of data that can be read without going over the maxLength.

- (NSUInteger) readLengthForNonTerm

For read packets without a set terminator, returns the safe length of data that can be read without exceeding the maxLength, or forcing a resize of the buffer if at all possible.

- (NSUInteger) readLengthForTerm

For read packets with a set terminator, returns the safe length of data that can be read without going over a terminator, or the maxLength, or forcing a resize of the buffer if at all possible.

It is assumed the terminator has not already been read.

- (NSUInteger) readLengthForTermWithPreBuffer: (NSData *)  preBuffer
found: (BOOL *)  foundPtr 

For read packets with a set terminator, returns the safe length of data that can be read from the given preBuffer, without going over a terminator or the maxLength.

It is assumed the terminator has not already been read.

- (NSInteger) searchForTermAfterPreBuffering: (NSUInteger)  numBytes

For read packets with a set terminator, scans the packet buffer for the term.

It is assumed the terminator had not been fully read prior to the new bytes.

If the term is found, the number of excess bytes after the term are returned. If the term is not found, this method will return -1.

Note: A return value of zero means the term was found at the very end.


Member Data Documentation

- (NSMutableData*) buffer
- (BOOL) bufferOwner
- (NSUInteger) bytesDone
- (NSUInteger) maxLength
- (NSUInteger) originalBufferLength
- (NSUInteger) readLength
- (NSUInteger) startOffset
- (long) tag
- (NSData*) term
- (NSTimeInterval) timeout

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines