Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

Implements

Index

Constructors

constructor

Methods

addAnnotation

  • addAnnotation(annotation: string): void

close

  • close(): void
  • Flushes data to the internal buffer and finalizes the Ion stream.

    throws

    Error if the Writer is already closed or the writer is not at the top-level (i.e. inside of a container).

    Returns void

depth

  • depth(): number

getBytes

  • getBytes(): Uint8Array
  • Retrieves the serialized buffer as an array of octets. The buffer will be either a UTF-8 encoded buffer for Ion text or Ion binary. The buffer is not well-defined until close is invoked.

    throws

    Error if close has not been invoked.

    Returns Uint8Array

setAnnotations

  • setAnnotations(annotations: string[]): void
  • Specifies the list of annotations to be used when writing the next value. This clears the current annotations set for the next value.

    Parameters

    • annotations: string[]

    Returns void

stepIn

  • Starts a container and positions the writer within that container.

    throws

    Error if type.container is not one of IonTypes.LIST, IonTypes.SEXP, or IonTypes.STRUCT.

    Parameters

    Returns void

stepOut

  • stepOut(): void
  • Steps out of a container and positions the writer after the container.

    throws

    Error if the writer is not inside a container.

    Returns void

writeBlob

  • writeBlob(value: null | Uint8Array): void
  • Writes a Uint8Array as an Ion blob value.

    Parameters

    • value: null | Uint8Array

      The array to write, which may be null to write a null.blob.

    Returns void

writeBoolean

  • writeBoolean(value: null | boolean): void
  • Writes a boolean as an Ion bool value.

    Parameters

    • value: null | boolean

      The boolean to write, which may be null to write a null.bool.

    Returns void

writeClob

  • writeClob(value: null | Uint8Array): void
  • Writes a Uint8Array as an Ion clob value.

    Parameters

    • value: null | Uint8Array

      The array to write, which may be null to write a null.clob.

    Returns void

writeDecimal

  • writeDecimal(value: null | Decimal): void

writeFieldName

  • writeFieldName(fieldName: string): void
  • Writes the field name for a member of a struct.

    throws

    Error if the Writer is not within a struct or this method was already called before a value was written.

    Parameters

    • fieldName: string

    Returns void

writeFloat32

  • writeFloat32(value: null | number): void
  • Writes a number value as an Ion 32-bit binary float value.

    Parameters

    • value: null | number

      The number to write, which may be null to write a null.float. If the number cannot be represented exactly as a 32-bit binary floating point value, an implementation may truncate or round the value.

    Returns void

writeFloat64

  • writeFloat64(value: null | number): void
  • Writes a number value as an Ion 64-bit binary float value.

    Parameters

    • value: null | number

      The number to write, which may be null to write a null.float.

    Returns void

writeInt

  • writeInt(value: null | number | bigint): void
  • Writes a number value as an Ion int.

    Parameters

    • value: null | number | bigint

      The number to write, which may be null to write a null.int. If number is not an integer between the range specified by Number.MIN_SAFE_INTEGER and Number.MAX_SAFE_INTEGER, an implementation may truncate or round the value.

    Returns void

writeNull

writeString

  • writeString(value: null | string): void
  • Writes a string value as an Ion string.

    Parameters

    • value: null | string

      The string to write, which may be null to write a null.string.

    Returns void

writeSymbol

  • writeSymbol(value: null | string): void
  • Writes a string value as an Ion symbol.

    Parameters

    • value: null | string

      The string to write, which may be null to write a null.symbol.

    Returns void

writeTimestamp

  • writeTimestamp(value: null | Timestamp): void

writeValue

  • writeValue(reader: Reader): void
  • Writes a reader's current value.

    If there's no current value, this method does nothing. If the current value is a container, this method will stepIn() recursively, writing each nested value that it encounters.

    It is illegal to call this method if this Writer is positioned within a Struct while the Reader is not.

    Parameters

    Returns void

writeValues

  • writeValues(reader: Reader): void
  • Writes a reader's current value and all following values until the end of the current container.

    If there's no current value then this method calls {@link next()} to get started. This method will stepIn() to containers recursively, writing each nested value that it encounters.

    It is illegal to call this method if this Writer is positioned within a Struct while the Reader is not.

    Parameters

    Returns void