SdFs
Public Member Functions | List of all members
StreamFile< BaseFile, PosType > Class Template Reference

StreamFile class. More...

#include <ArduinoFiles.h>

Inheritance diagram for StreamFile< BaseFile, PosType >:
Inheritance graph
[legend]
Collaboration diagram for StreamFile< BaseFile, PosType >:
Collaboration graph
[legend]

Public Member Functions

int available ()
 
void flush ()
 
bool isDirectory ()
 
const char * name () const
 
StreamFile openNextFile (uint8_t mode=O_READ)
 
int peek ()
 
PosType position ()
 
int read ()
 
void rewindDirectory ()
 
bool seek (PosType pos)
 
PosType size ()
 
size_t write (uint8_t b)
 

Detailed Description

template<class BaseFile, typename PosType>
class StreamFile< BaseFile, PosType >

StreamFile class.

Member Function Documentation

template<class BaseFile, typename PosType>
int StreamFile< BaseFile, PosType >::available ( )
inline
Returns
number of bytes available from the current position to EOF or INT_MAX if more than INT_MAX bytes are available.
template<class BaseFile, typename PosType>
void StreamFile< BaseFile, PosType >::flush ( )
inline

Ensure that any bytes written to the file are saved to the SD card.

template<class BaseFile, typename PosType>
bool StreamFile< BaseFile, PosType >::isDirectory ( )
inline

This function reports if the current file is a directory or not.

Returns
true if the file is a directory.
template<class BaseFile, typename PosType>
const char* StreamFile< BaseFile, PosType >::name ( ) const
inline

No longer implemented due to Long File Names.

Use getName(char* name, size_t size).

Returns
a pointer to replacement suggestion.
template<class BaseFile, typename PosType>
StreamFile StreamFile< BaseFile, PosType >::openNextFile ( uint8_t  mode = O_READ)
inline

Opens the next file or folder in a directory.

Parameters
[in]modeopen mode flags.
Returns
a FatStream object.
template<class BaseFile, typename PosType>
int StreamFile< BaseFile, PosType >::peek ( )
inline

Return the next available byte without consuming it.

Returns
The byte if no error and not at eof else -1;
template<class BaseFile, typename PosType>
PosType StreamFile< BaseFile, PosType >::position ( )
inline
Returns
the current file position.
template<class BaseFile, typename PosType>
int StreamFile< BaseFile, PosType >::read ( )
inline

Read the next byte from a file.

Returns
For success return the next byte in the file as an int. If an error occurs or end of file is reached return -1.
template<class BaseFile, typename PosType>
void StreamFile< BaseFile, PosType >::rewindDirectory ( )
inline

Rewind a file if it is a directory

template<class BaseFile, typename PosType>
bool StreamFile< BaseFile, PosType >::seek ( PosType  pos)
inline

Seek to a new position in the file, which must be between 0 and the size of the file (inclusive).

Parameters
[in]posthe new file position.
Returns
true for success else false.
template<class BaseFile, typename PosType>
PosType StreamFile< BaseFile, PosType >::size ( )
inline
Returns
the file's size.
template<class BaseFile, typename PosType>
size_t StreamFile< BaseFile, PosType >::write ( uint8_t  b)
inline

Write a byte to a file. Required by the Arduino Print class.

Parameters
[in]bthe byte to be written. Use getWriteError to check for errors.
Returns
1 for success and 0 for failure.

The documentation for this class was generated from the following file: