ServerJS/Binary/C: Difference between revisions

no edit summary
No edit summary
Line 130: Line 130:
:This method is optional, it should be included if the interpreter being used supports .toSource() on it's various objects and types.
:This method is optional, it should be included if the interpreter being used supports .toSource() on it's various objects and types.
:Returns a representation of the blob in the format "(Blob([]))" or "(new Blob([]))". If the blob has content in it the string should contain integers 0..255 representing the blob such that if evaluated (calling the correct Blob function) would return a blob with the same content.
:Returns a representation of the blob in the format "(Blob([]))" or "(new Blob([]))". If the blob has content in it the string should contain integers 0..255 representing the blob such that if evaluated (calling the correct Blob function) would return a blob with the same content.
;blob.contentConstructor;
:Returns Blob to indicate this has binary content.


=== Unpacking ===
=== Unpacking ===
Line 224: Line 227:
:* In a BlobBuffer this returns a Blob which matches the contents of the buffer.
:* In a BlobBuffer this returns a Blob which matches the contents of the buffer.
:* In a StringBuffer this returns a String which matches the contents of the buffer.
:* In a StringBuffer this returns a String which matches the contents of the buffer.
;buf.contentConstructor;
:Returns Blob from a BlobBuffer to indicate it has binary content, and String from StringBuffer to indicate it has text content.


=== String extensions ===
=== String extensions ===
Line 238: Line 244:
:An alias for string.charCodeAt(index);
:An alias for string.charCodeAt(index);
:The point of this prototype is so that (string or blob).codeAt(index); may be used independently of whether the sequence is a string or a blob. This will allow strings to maintain .charCodeAt and blobs to maintain .byteCodeAt without returning unintuitive results.
:The point of this prototype is so that (string or blob).codeAt(index); may be used independently of whether the sequence is a string or a blob. This will allow strings to maintain .charCodeAt and blobs to maintain .byteCodeAt without returning unintuitive results.
;string.contentConstructor;
:Returns String to indicate this has text content.


== General requirements ==
== General requirements ==
40

edits