read
Returns the number of bytes read. It may be less than buffer.len. If the number of bytes read is 0, it means end of stream. End of stream is not an error condition.
Function parameters
Parameters
Optional parameters for `skipBytes`
Types
- SkipBytesOptions
- Optional parameters for `skipBytes`
Returns the number of bytes read.
Functions
- read
- Returns the number of bytes read.
- readAll
- Returns the number of bytes read.
- readAtLeast
- Returns the number of bytes read, calling the underlying read
- readNoEof
- If the number read would be smaller than `buf.len`, `error.EndOfStream` is returned instead.
- readAllArrayList
- Appends to the `std.array_list.Managed` contents by reading from the stream
- readAllAlloc
- Allocates enough memory to hold all the contents of the stream.
- readUntilDelimiterArrayList
- Deprecated: use `streamUntilDelimiter` with ArrayList's writer instead.
- readUntilDelimiterAlloc
- Deprecated: use `streamUntilDelimiter` with ArrayList's writer instead.
- readUntilDelimiter
- Deprecated: use `streamUntilDelimiter` with FixedBufferStream's writer instead.
- readUntilDelimiterOrEofAlloc
- Deprecated: use `streamUntilDelimiter` with ArrayList's (or any other's) writer instead.
- readUntilDelimiterOrEof
- Deprecated: use `streamUntilDelimiter` with FixedBufferStream's writer instead.
- streamUntilDelimiter
- Appends to the `writer` contents by reading from the stream until `delimiter` is found.
- skipUntilDelimiterOrEof
- Reads from the stream until specified byte is found, discarding all data,
- readByte
- Reads 1 byte from the stream or returns `error.EndOfStream`.
- readByteSigned
- Same as `readByte` except the returned byte is signed.
- readBytesNoEof
- Reads exactly `num_bytes` bytes and returns as an array.
- skipBytes
- Reads `num_bytes` bytes from the stream and discards them
- isBytes
- Reads `slice.len` bytes from the stream and returns if they are the same as the passed slice
- readEnum
- Reads an integer with the same size as the given enum's tag type.
- discard
- Reads the stream until the end, ignoring all the data.
- adaptToNewApi
- Helper for bridging to the new `Reader` API while upgrading.
Source
Implementation
pub fn read(self: Self, buffer: []u8) anyerror!usize {
return self.readFn(self.context, buffer);
}