Creates a new byte stream using as data the string pointer and the size. The axlStream object is an abstraction that allows to interface with a memory chunk, a file descriptor (or a socket) or a direct path, with a contenience API that allows inspecting and accepting the streamed content. Here is an example on how to create an stream from a memory chunk: axlStream * stream; axlError * error; // create the stream and check result stream = axl_stream_new (source_content, size_content, -1, NULL, &error); if (stream == NULL) { printf ("An error was found: %s\n", axl_error_get (error)); axl_error_free (error); return; } // stream created In the case an stream is required to parse a file descriptor (including a socket):
stream = axl_stream_new (NULL, -1, NULL, fd, &error); You can also provide a file path to let the axl stream module to open the file and buffer it as it requires to consume characters:
stream = axl_stream_new (NULL, -1, "c:/myFiles/document.xml", -1, &error); Once initialized the axlStream object, you can use the following function to check and consume characters:
There alternatives APIs that allows to get the content until some patter is found (or a set of patterns):
|