WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:data: scheme
Description:defines identifiers which contain an inline SOURCE representation
Id:layer1.DataScheme
Category:accessor
Identifier Syntax

data: scheme is an accessor using a standard identifier grammar:

<grammar>
  <group>
    <group>data:
      <group min="0">
        <group name="mimetype">
          <regex type="nmtoken" />/
          <regex type="nmtoken" />
        </group>
        <group min="0">;charset=
          <group name="charset">
            <regex type="nmtoken" />
          </group>
        </group>
      </group>
      <group min="0" name="encoding">;base64</group>,
      <group name="data">
        <regex type="anything" />
      </group>
    </group>
  </group>
</grammar>

with the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
mimetypeString (unknown)(no description available)
charsetString (nmtoken)(no description available)
encodingString (unknown)(no description available)
dataString (anything)(no description available)
Request Verbs

The following verbs are supported:

Verbs
SOURCEEXISTS
Response

The following response representations can be returned for SOURCE requests:

SOURCE Representations
Readable Binary Stream

This accessor throws no documented exceptions.

Import Requirements

To use data: scheme accessor you must import the module urn:com:1060research:www3:

<import>
  <uri>urn:com:1060research:www3</uri>
</import>

The data: scheme supports the IETF RFC2397 specification for in-line data within a URI.

Syntax

The syntax for the scheme is:

Resource Identifier Syntax

data: [MimeType] [;chaset="<encoding>"] [;base64], {data}

For example, the following embeds a picture of a small red dot:

data:image/png;base64,
iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABGdBTUEAALGP
C/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9YGARc5KB0XV+IA
AAAddEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIFRoZSBHSU1Q72QlbgAAAF1J
REFUGNO9zL0NglAAxPEfdLTs4BZM4DIO4C7OwQg2JoQ9LE1exdlYvBBeZ7jq
ch9//q1uH4TLzw4d6+ErXMMcXuHWxId3KOETnnXXV6MJpcq2MLaI97CER3N0
vr4MkhoXe0rZigAAAABJRU5ErkJggg==

and the following:

data:text/html;base64,PGh0bWw+PGJvZHk+PHA+aGk8L3A+PC9ib2R5PjwvaHRtbD4=

embeds the following HTML:

<html>
  <body>
    <p>hi</p>
  </body>
</html>

SOURCE

When a request with the SOURCE verb is issued for a representation encoded with the data: scheme, the value of the information is returned as a org.netkernel.layer0.representation.IReadableBinaryStreamRepresentation.

Example

In the following example the contents of the variable text will be set to "this is data":

request = context.createRequest("data:text/plain,this%20is%20data");
request.setRepresentationClass(String.class);
text = context.issueRequest(request);

EXISTS

When a request with the EXISTS verb is issued a test is made to see if the data exists.

The response contains a boolean value of either true or false indicating if the file or directory exists or not.

Example

In the following example the data: scheme is queried for the existence of a representation:

request = context.createRequest("data:text/html;base64,PGh0bWw+PGJvZHk+PHA+aGk8L3A+PC9ib2R5PjwvaHRtbD4=");
request.setVerb(INKFRequestReadOnly.VERB_EXISTS);
request.setRepresentationClass(Boolean.class);
dataAvailable = context.issueRequest(request);