---
title: "getBuffer(_:length:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/inputstream/getbuffer(_:length:)"
---

# getBuffer(_:length:)

Returns by reference a pointer to a read buffer and, by reference, the number of bytes available, and returns a Boolean value that indicates whether the buffer is available.

## Declaration

```swift
func getBuffer(_ buffer: UnsafeMutablePointer<UnsafeMutablePointer<UInt8>?>, length len: UnsafeMutablePointer<Int>) -> Bool
```

## Parameters

- `buffer`: Upon return, contains a pointer to a read buffer. The buffer is only valid until the next stream operation is performed.
- `len`: Upon return, contains the number of bytes available.

## Return Value

Return Value true if the buffer is available, otherwise false.

## Discussion

Discussion Subclasses of NSInputStream may return false if this operation is not appropriate for the stream type.

## See Also

### Using Streams

- [read(_:maxLength:)](foundation/inputstream/read(_:maxlength:).md)
- [hasBytesAvailable](foundation/inputstream/hasbytesavailable.md)
