From v4.1 to v4.2


Stream methods

The Stream::readBytes() has been virtualised and overridden for IDataSourceStream descendents for more efficient operation, especially with ArduinoJson. For normal read operations where the stream position is to be updated, applications should use this method in preference to IDataSourceStream::readMemoryBlock().

An addition method IDataSourceStream::moveString() has been added to support extracting the content of a memory-based stream into a String object without duplicating the data. This is supported by LimitedMemoryStream and MemoryDataStream.

Stream / file seeking

To provide a consistent interface SeekOrigin is now used with all seek methods for streams, and also by file system functions. Mappings are:

SeekOrigin::Start instead of eSO_FileStart
SeekOrigin::Current instead of eSO_CurrentPos
SeekOrigin::End instead of eSO_FileEnd

These map to the standard C SEEK_SET, SEEK_CUR and SEEK_END but as SeekOrigin is strongly typed it offers compile-time checking, and has a toString(SeekOrigin) overload.

getBody methods

The HttpRequest::getBody() and HttpResponse::getBody() methods have been revised to use move semantics. Previously, the data was copied into a new String which effectively doubled memory usage.

If you have set a non-memory stream type (e.g. FileStream) which does not implement IDataSourceStream::moveString() then an invalid String will be returned. In this situation you should use HttpResponse::getBodyStream() instead.

ContentType / MIME types

String toString(MimeType)() has been moved out of the ContentType namespace, so no longer requires the ContentType:: qualifier.