Reading data URI scheme, see http://en.wikipedia.org/wiki/Data_URI_scheme. Such URI specifies the MIME type and contains the data, encoded in plain text or base64. That is, the data is not merely referenced / linked (like with a usual URL), it's simply fully encoded inside the URI. Since such URI can be used anywhere a normal URI is expected, it allows you to inline any kind of data inside any container file. For example, you can place images (textures) and such directly inside a VRML/X3D file.
class function IsDataURI(const URI: string; out Colon: Integer): boolean;
class function IsDataURI(const URI: string): boolean;
function Stream: TStream;
Read the actual data contents. If the URI is not valid (includes the initial state when it's not set) then returns Nil.
The important property of this reader is that no expensive encoding is done until you call this method. In particular, you can set URI, check MimeType, and if you see that MimeType is something not interesting for you (for example, maybe you require some image type) just don't call this method. Then nothing expensive will happen, e.g. data will not be base64-decoded without a need.
function ExtractStream: TStream;
Get Stream and clear it. Makes the stream no longer owner by this TDataURI instance.
Do not call Stream after calling ExtractStream. Results are undefined. (Right now, another decoding stream will then be created, that will return the same thing as previous stream. But do not depend on it.)
Force Stream and ExtractStream to return a TMemoryStream, that is always seekable and fully buffered in memory. Without this, they may return TBase64DecodingStream that may not be seekable.
property URI: string read FURI write SetURI;
The data URI that this class reads.
When you set this, we read the beginning of URI. If this is a valid data URI, then we set Valid to True, update MimeType, Base64, Charset, URIPrefix accordingly, and you can call Stream if you want to read actual contents.