@haxall/haxall
    Preparing search index...

    Class TurtleOutStream

    Writes RDF in Turtle format

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    type$: Type

    Methods

    • The current charset used to encode Unicode characters into bytes. The default charset should always be UTF-8.

      Returns Charset

    • The current charset used to encode Unicode characters into bytes. The default charset should always be UTF-8.

      Parameters

      Returns void

    • Close the output stream. This method is guaranteed to never throw an IOErr. Return true if the stream was closed successfully or false if the stream was closed abnormally. Default implementation does nothing and returns true.

      Returns boolean

    • Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:

      this < that   =>  <0
      this == that => 0
      this > that => >0

      This method may also be accessed via the < <= <=> >= and > shortcut operators. If not overridden the default implementation compares the toStr representations. Also see docLang.

      Examples:

      3.compare(8)  =>  -1
      8.compare(3) => 1
      8.compare(8) => 0
      3 <=> 8 => -1 // shortcut for 3.compare(8)

      Parameters

      Returns number

    • Byte order mode for binary writes. Default is Endian.big (network byte order).

      Returns Endian

    • Byte order mode for binary writes. Default is Endian.big (network byte order).

      Parameters

      Returns void

    • Compare this object to the specified for equality. This method may be accessed via the == and != shortcut operators. If not overridden the default implementation compares for reference equality using the === operator. If this method is overridden, then hash() must also be overridden such that any two objects which return true for equals() must return the same value for hash(). This method must accept null and return false.

      Parameters

      Returns boolean

    • There is no guarantee that any (or all) bytes are written to the output stream until this method is called. Therefore, when you are finished writing all RDF statements, you must call this method to allow the implementation a chance to finish any pending writes.

      This method should only be invoked once when you are done writing all statements. The behavior is undefined if you invoke this method multiple times.

      Closing this output stream will always call finish first.

      Returns this

    • Flush the stream so any buffered bytes are written out. Default implementation does nothing. Throw IOErr on error. Return this.

      Returns this

    • Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.

      Returns number

    • Return if this Obj is immutable and safe to share between threads:

      • an instance of a const class
      • the result of toImmutable on List, Map, or Buf
      • a Func object may or may not be immutable - see sys::Func.
      • other instances are assumed mutable and return false

      Returns boolean

    • Convenience for writeChars(obj.toStr). If obj is null, then print the string "null". Return this.

      Parameters

      Returns this

    • Convenience for writeChars(obj.toStr + "\n"). If obj is null then print the string "null\n". Return this.

      Parameters

      Returns this

    • Associate a prefix with a namespace. If the prefix is already mapped to a different namespace, then throw ArgErr.

      If an RDF export format doesn't support namesapce prefixes, this is a no-op. The behavior of the RDF out stream is undefined if you call this method of you have called writeStmt, so you should set all your namespace prefixes prior to writing statements.

      Return this.

      out.setNs("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#")
      

      Parameters

      • prefix: string
      • namespace: string

      Returns this

    • If this output stream is mapped to a file device, then synchronize all memory buffers to the physical storage device. Throw IOErr on error. Return this.

      Returns this

    • Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:

      • if type is const, return this
      • if already an immutable List, Map, Buf, or Func return this
      • if a List, then attempt to perform a deep clone by calling toImmutable on all items
      • if a Map, then attempt to perform a deep clone by calling toImmutable on all values (keys are already immutable)
      • some Funcs can be made immutable - see sys::Func
      • if a Buf create immutable copy, see sys::Buf
      • any other object throws NotImmutableErr

      Returns Readonly<this>

    • Return a string representation of this object.

      Returns string

    • Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:

      a->x        a.trap("x", null)
      a->x() a.trap("x", null)
      a->x = b a.trap("x", [b])
      a->x(b) a.trap("x", [b])
      a->x(b, c) a.trap("x", [b, c])

      The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.

      Parameters

      Returns JsObj

    • Get the Type instance which represents this object's class. Also seeType.of or Pod.of.

      Returns Type

    • This method called whenever an it-block is applied to an object. The default implementation calls the function with this, and then returns this.

      Parameters

      • f: (arg0: this) => void

      Returns this

    • Write a byte to the output stream. Throw IOErr on error. Return this.

      Parameters

      • byte: number

      Returns this

    • Write between 0 and 64 bits of the given integer value. Bits which are only a partial byte are bufferred in RAM until flush.

      Parameters

      • val: number
      • num: number

      Returns this

    • Write one byte, one if true or zero if false. This method is paired with InStream.readBool. Throw IOErr on error. Return this.

      Parameters

      • b: boolean

      Returns this

    • Write n bytes from the specified Buf at its current position to this output stream. If n is defaulted to buf.remaining(), then everything left in the buffer is drained to this output stream. The buf's position is advanced n bytes upon return. Throw IOErr on error. Return this.

      Parameters

      • buf: Buf
      • Optionaln: number

      Returns this

    • Write one or more bytes to the stream for the specified Unicode character based on the current charset encoding. Return this.

      Parameters

      • char: number

      Returns this

    • Write the Unicode characters in the specified string to the stream using the current charset encoding. The off arg specifies the index offset to start writing characters and len the number of characters in str to write. Return this.

      Parameters

      • str: string
      • Optionaloff: number
      • Optionallen: number

      Returns this

    • Write a decimal as a string according to writeUtf.

      Parameters

      • d: number

      Returns this

    • Write four bytes as a 32-bit floating point number using configured endian order according to Float.bits32. This is paired with InStream.readF4. Throw IOErr on error. Return this.

      Parameters

      • r: number

      Returns this

    • Write eight bytes as a 64-bit floating point number using configured endian order according to Float.bits. This is paired with InStream.readF8. Throw IOErr on error. Return this.

      Parameters

      • r: number

      Returns this

    • Write two bytes as a 16-bit number using configured endian. This method may be paired with InStream.readU2 or InStream.readS2. Throw IOErr on error. Return this.

      Parameters

      • n: number

      Returns this

    • Write four bytes as a 32-bit number using configured endian. This method may be paired with InStream.readU4 or InStream.readS4. Throw IOErr on error. Return this.

      Parameters

      • n: number

      Returns this

    • Write eight bytes as a 64-bit number using configured endian. This is paired with InStream.readS8. Throw IOErr on error. Return this.

      Parameters

      • n: number

      Returns this

    • Write a serialized object from the stream according to the Fantom serialization format. Throw IOErr on error. Return this.

      The options may be used to specify the format of the output:

      • "indent": Int specifies how many spaces to indent each level. Default is 0.
      • "skipDefaults": Bool specifies if we should skip fields at their default values. Field values are compared according to the equals method. Default is false.
      • "skipErrors": Bool specifies if we should skip objects which aren't serializable. If true then we output null and a comment. Default is false.

      Parameters

      Returns this

    • Write the given map of Str name/value pairs to the output stream according to the Fantom props file format (see InStream.readProps for full specification). The props are written using UTF-8 regardless of this stream's current charset. If close argument is true, then automatically close the stream. Return this.

      Parameters

      • props: Map<string, string>
      • Optionalclose: boolean

      Returns this

    • Write the given RDF statement.

      All writers should handle mapping the following Fantom types to well-defined RDF data types without requiring a type for typeOrLocale parameter.

      • Str => xsd::string
      • Uri => xsd::anyURI
      • Num => xsd::integer | xsd::decimal | xsd::double
      • Bool => xsd::boolean
      • Date => xsd::date
      • Time => xsd::time
      • DateTime => xsd::dateTime
      • Buf => xsd::hexBinary

      A non-null typeOrLocale parameter is used as follows:

      • An Iri indicates the data type of the object parameter. In this case the object will always be encoded as a string.
      • A Locale indicates the language the object is in. In this case the object should be a string.

      Not all export formats can make use of the information in typeOrLocale parameter, but you should always provide it if available.

      Return this.

      Parameters

      Returns this

    • Write a Str in modified UTF-8 format according to the java.io.DataOutput specification. This method is paired with InStream.readUtf. Throw IOErr on error. Return this.

      Parameters

      • s: string

      Returns this

    • Write a string to this output stream using XML escape sequences. By default only the < > & characters are escaped. You can use the following flags to escape additional characters:

      Any control character less than 0x20 which is not \t, \n or \r is always escaped with a numeric reference. Return this.

      Parameters

      • str: string
      • Optionalmode: number

      Returns this

    • Write x.toStr to standard output followed by newline. If x is null then print "null". If no argument is provided then print an empty line.

      Parameters

      Returns void

    • Return true if the given string is a legal label name for a blank node.

      The characters in the label are built upon PN_CHARS_BASE, liberalized as follows

      • The characters _ and digits may appear anywhere in a blank node label.
      • The character . may appear anywhere except the first or last character.
      • The characters -, U+00B7, U+0300 to U+036F and U+203F to U+2040 are permitted anywhere except the first character.
      PN_CHARS_BASE ::= [A-Z] | [a-z] | [#x00C0-#x00D6] | [#x00D8-#x00F6]
      | [#x00F8-#x02FF] | [#x0370-#x037D] | [#x037F-#x1FFF] | [#x200C-#x200D]
      | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF]
      | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]

      See https://www.w3.org/TR/turtle/#BNodes

      Parameters

      • name: string

      Returns boolean

    • Validate the blank node and return it if it is valid; otherwise raise ArgErr.

      Parameters

      Returns Iri

    • XML escape newline characters. See writeXml.

      Returns number

    • XML escape single and double quotes. See writeXml.

      Returns number

    • XML escape any character greater then 0x7f. See writeXml.

      Returns number