|
|
|
|
- Management of the MIME type
URIToBuffer (Function) In french: URIVersBuffer Loads in the background the content of a resource (image, text, etc.) identified by its URI in a buffer variable. Syntax
URIToBuffer(<URI> , <WLanguage procedure> [, <MIME type>])
<URI>: URI or character string variable Resource to load. This resource can correspond to: - the name of a variable of type URI.
Reminder: URISelect selects a resource and gets its URI. - a character string.
<WLanguage procedure>: Procedure name Name of WLanguage procedure ("callback") called once the buffer has been loaded. This procedure has the following format:
PROCEDURE <Procedure name>(<Result>, <Buffer>, <Format)
where: - <Result> is a boolean:
- True if the buffer was loaded,
- False otherwise. To get the details of the error, use ErrorInfo before any other call to a WLanguage function (this would reinitialize the error).
- <Buffer> is a Buffer variable initialized with the content of the resource.
- <Format> is a character string that represents the MIME type and the file extension of the format in which the resource was loaded (it may be different from the original format if the resource was converted). This string has the following format:
<MIME type> + TAB + <Extension>
Example: "application/pdf + TAB + .pdf"
<MIME type>: Optional character string MIME type corresponding to the format in which the resource must be loaded (see Notes). If this parameter is not specified or corresponds to an empty string (""), the resource will be saved in its original format if possible or it will first be converted into a default format. Reminder: The format used to load the resource will be passed as a parameter of the procedure called once the loading is completed. Remarks Management of the MIME type When the resource to load does not come from the device's file system, the content provider that manages the resource may need to convert it. This is usually the case if no application on the device can manage the original format of the resource. It is possible to specify the conversion format of the resource by entering the parameter <MIME type>. To find out the MIME type into which a resource can be converted, use URIGetInfo with the constant uriInfoConversionType. If this function returns an empty string (""), the resource cannot be saved. In this case, do not call URIToBuffer on this resource, since it will fail. Example: a Microsoft Word file (.doc or.docx) is selected using URISelect. This file is on Google Drive and no application on the device can handle this type of document. When saving this resource, the content provider will automatically convert this resource to PDF format. In this case, URIGetInfo used with the constant uriInfoConversionType will return the following string: "application/pdf + TAB + .pdf". Component: wd280android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|