mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
Stream Class Reference
[Stream class]
File stream. More...
#include <Stream.h>
Inherits mbed::FileLike, NonCopyable< Stream >, mbed::FileLike, and NonCopyable< Stream >.
Inherited by Serial, and Serial.
Public Member Functions | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by FileHandle::seek") virtual off_t lseek(off_t offset | |
Move the file position to a given offset from a given location. | |
MBED_DEPRECATED_SINCE ("mbed-os-5.4","Replaced by FileHandle::seek") virtual off_t lseek(off_t offset | |
Move the file position to a given offset from a given location. | |
Protected Member Functions | |
virtual int | close () |
Close a file. | |
virtual ssize_t | write (const void *buffer, size_t length) |
Write the contents of a buffer to a file. | |
virtual ssize_t | read (void *buffer, size_t length) |
Read the contents of a file into a buffer. | |
virtual off_t | seek (off_t offset, int whence) |
Move the file position to a given offset from from a given location. | |
virtual off_t | tell () |
Get the file position of the file. | |
virtual void | rewind () |
Rewind the file position to the beginning of the file. | |
virtual int | isatty () |
Check if the file in an interactive terminal device. | |
virtual int | sync () |
Flush any buffers associated with the file. | |
virtual off_t | size () |
Get the size of the file. | |
virtual void | lock () |
Acquire exclusive access to this object. | |
virtual void | unlock () |
Release exclusive access to this object. | |
virtual int | close () |
Close a file. | |
virtual ssize_t | write (const void *buffer, size_t length) |
Write the contents of a buffer to a file. | |
virtual ssize_t | read (void *buffer, size_t length) |
Read the contents of a file into a buffer. | |
virtual off_t | seek (off_t offset, int whence) |
Move the file position to a given offset from from a given location. | |
virtual off_t | tell () |
Get the file position of the file. | |
virtual void | rewind () |
Rewind the file position to the beginning of the file. | |
virtual int | isatty () |
Check if the file in an interactive terminal device. | |
virtual int | sync () |
Flush any buffers associated with the file. | |
virtual off_t | size () |
Get the size of the file. | |
virtual void | lock () |
Acquire exclusive access to this object. | |
virtual void | unlock () |
Release exclusive access to this object. | |
MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
NonCopyable copy constructor. | |
MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
NonCopyable copy assignment operator. | |
MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
NonCopyable copy constructor. | |
MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
NonCopyable copy assignment operator. | |
MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
NonCopyable copy constructor. | |
MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
NonCopyable copy assignment operator. | |
Private Member Functions | |
MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
NonCopyable copy constructor. | |
MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
NonCopyable copy assignment operator. |
Detailed Description
File stream.
- Note:
- Synchronization level: Set by subclass
Definition at line 42 of file cmsis/BUILD/mbed/platform/Stream.h.
Member Function Documentation
virtual int close | ( | ) | [protected, virtual] |
int close | ( | ) | [protected, virtual] |
Close a file.
- Returns:
- 0 on success, negative error code on failure
Implements FileHandle.
Definition at line 77 of file Stream.cpp.
int isatty | ( | ) | [protected, virtual] |
Check if the file in an interactive terminal device.
- Returns:
- True if the file is a terminal
- False if the file is not a terminal
- Negative error code on failure
Reimplemented from FileHandle.
Definition at line 130 of file Stream.cpp.
virtual int isatty | ( | ) | [protected, virtual] |
Check if the file in an interactive terminal device.
- Returns:
- True if the file is a terminal
- False if the file is not a terminal
- Negative error code on failure
Reimplemented from FileHandle.
virtual void lock | ( | void | ) | [protected, virtual] |
Acquire exclusive access to this object.
Reimplemented in Serial, and Serial.
Definition at line 80 of file cmsis/BUILD/mbed/platform/Stream.h.
virtual void lock | ( | void | ) | [protected, virtual] |
Acquire exclusive access to this object.
Reimplemented in Serial, and Serial.
Definition at line 80 of file platform/Stream.h.
MBED_DEPRECATED | ( | "Invalid copy construction of a NonCopyable< FileBase > resource." | ) | const [protected, inherited] |
NonCopyable copy constructor.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
Definition at line 190 of file cmsis/BUILD/mbed/platform/NonCopyable.h.
MBED_DEPRECATED | ( | "Invalid copy assignment of a NonCopyable< FileHandle > resource." | ) | [protected, inherited] |
NonCopyable copy assignment operator.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
MBED_DEPRECATED | ( | "Invalid copy construction of a NonCopyable< FileHandle > resource." | ) | const [protected, inherited] |
NonCopyable copy constructor.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
Definition at line 190 of file cmsis/BUILD/mbed/platform/NonCopyable.h.
MBED_DEPRECATED | ( | "Invalid copy assignment of a NonCopyable< FileBase > resource." | ) | [protected, inherited] |
NonCopyable copy assignment operator.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
MBED_DEPRECATED | ( | "Invalid copy construction of a NonCopyable< FileLike > resource." | ) | const [protected, inherited] |
NonCopyable copy constructor.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
Definition at line 190 of file cmsis/BUILD/mbed/platform/NonCopyable.h.
MBED_DEPRECATED | ( | "Invalid copy assignment of a NonCopyable< FileLike > resource." | ) | [protected, inherited] |
NonCopyable copy assignment operator.
A compile time warning is issued when this function is used, and a runtime warning is printed when the copy construction of the noncopyable happens.
If you see this warning, your code is probably doing something unspecified. Copying of noncopyable resources can lead to resource leak and random error.
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by FileHandle::seek" | |||
) | [inherited] |
Move the file position to a given offset from a given location.
- Parameters:
-
offset The offset from whence to move to whence SEEK_SET for the start of the file, SEEK_CUR for the current file position, or SEEK_END for the end of the file.
- Returns:
- new file position on success, -1 on failure or unsupported
MBED_DEPRECATED_SINCE | ( | "mbed-os-5.4" | , |
"Replaced by FileHandle::seek" | |||
) | [inherited] |
Move the file position to a given offset from a given location.
- Parameters:
-
offset The offset from whence to move to whence SEEK_SET for the start of the file, SEEK_CUR for the current file position, or SEEK_END for the end of the file.
- Returns:
- new file position on success, -1 on failure or unsupported
virtual ssize_t read | ( | void * | buffer, |
size_t | size | ||
) | [protected, virtual] |
Read the contents of a file into a buffer.
Devices acting as FileHandles should follow POSIX semantics:
* if no data is available, and nonblocking set, return -EAGAIN * if no data is available, and blocking set, wait until some data is available * If any data is available, call returns immediately
- Parameters:
-
buffer The buffer to read in to size The number of bytes to read
- Returns:
- The number of bytes read, 0 at end of file, negative error on failure
Implements FileHandle.
ssize_t read | ( | void * | buffer, |
size_t | size | ||
) | [protected, virtual] |
Read the contents of a file into a buffer.
Devices acting as FileHandles should follow POSIX semantics:
* if no data is available, and nonblocking set, return -EAGAIN * if no data is available, and blocking set, wait until some data is available * If any data is available, call returns immediately
- Parameters:
-
buffer The buffer to read in to size The number of bytes to read
- Returns:
- The number of bytes read, 0 at end of file, negative error on failure
Implements FileHandle.
Definition at line 98 of file Stream.cpp.
virtual void rewind | ( | ) | [protected, virtual] |
Rewind the file position to the beginning of the file.
- Note:
- This is equivalent to seek(0, SEEK_SET)
Reimplemented from FileHandle.
void rewind | ( | ) | [protected, virtual] |
Rewind the file position to the beginning of the file.
- Note:
- This is equivalent to seek(0, SEEK_SET)
Reimplemented from FileHandle.
Definition at line 126 of file Stream.cpp.
virtual off_t seek | ( | off_t | offset, |
int | whence | ||
) | [protected, virtual] |
Move the file position to a given offset from from a given location.
- Parameters:
-
offset The offset from whence to move to whence The start of where to seek SEEK_SET to start from beginning of file, SEEK_CUR to start from current position in file, SEEK_END to start from end of file
- Returns:
- The new offset of the file, negative error code on failure
Implements FileHandle.
off_t seek | ( | off_t | offset, |
int | whence | ||
) | [protected, virtual] |
Move the file position to a given offset from from a given location.
- Parameters:
-
offset The offset from whence to move to whence The start of where to seek SEEK_SET to start from beginning of file, SEEK_CUR to start from current position in file, SEEK_END to start from end of file
- Returns:
- The new offset of the file, negative error code on failure
Implements FileHandle.
Definition at line 116 of file Stream.cpp.
off_t size | ( | ) | [protected, virtual] |
Get the size of the file.
- Returns:
- Size of the file in bytes
Reimplemented from FileHandle.
Definition at line 140 of file Stream.cpp.
virtual off_t size | ( | ) | [protected, virtual] |
int sync | ( | ) | [protected, virtual] |
Flush any buffers associated with the file.
- Returns:
- 0 on success, negative error code on failure
Reimplemented from FileHandle.
Definition at line 135 of file Stream.cpp.
virtual int sync | ( | ) | [protected, virtual] |
Flush any buffers associated with the file.
- Returns:
- 0 on success, negative error code on failure
Reimplemented from FileHandle.
off_t tell | ( | ) | [protected, virtual] |
Get the file position of the file.
- Note:
- This is equivalent to seek(0, SEEK_CUR)
- Returns:
- The current offset in the file, negative error code on failure
Reimplemented from FileHandle.
Definition at line 121 of file Stream.cpp.
virtual off_t tell | ( | ) | [protected, virtual] |
Get the file position of the file.
- Note:
- This is equivalent to seek(0, SEEK_CUR)
- Returns:
- The current offset in the file, negative error code on failure
Reimplemented from FileHandle.
virtual void unlock | ( | void | ) | [protected, virtual] |
Release exclusive access to this object.
Reimplemented in Serial, and Serial.
Definition at line 87 of file cmsis/BUILD/mbed/platform/Stream.h.
virtual void unlock | ( | void | ) | [protected, virtual] |
Release exclusive access to this object.
Reimplemented in Serial, and Serial.
Definition at line 87 of file platform/Stream.h.
ssize_t write | ( | const void * | buffer, |
size_t | size | ||
) | [protected, virtual] |
Write the contents of a buffer to a file.
Devices acting as FileHandles should follow POSIX semantics:
* if blocking, block until all data is written * if no data can be written, and nonblocking set, return -EAGAIN * if some data can be written, and nonblocking set, write partial
- Parameters:
-
buffer The buffer to write from size The number of bytes to write
- Returns:
- The number of bytes written, negative error on failure
Implements FileHandle.
Definition at line 82 of file Stream.cpp.
virtual ssize_t write | ( | const void * | buffer, |
size_t | size | ||
) | [protected, virtual] |
Write the contents of a buffer to a file.
Devices acting as FileHandles should follow POSIX semantics:
* if blocking, block until all data is written * if no data can be written, and nonblocking set, return -EAGAIN * if some data can be written, and nonblocking set, write partial
- Parameters:
-
buffer The buffer to write from size The number of bytes to write
- Returns:
- The number of bytes written, negative error on failure
Implements FileHandle.
Generated on Tue Jul 12 2022 20:41:18 by 1.7.2